[buoh/cleanups: 1/2] build: fix ui validation
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [buoh/cleanups: 1/2] build: fix ui validation
- Date: Wed, 23 Jan 2019 10:54:45 +0000 (UTC)
commit b6f9ec3102996a651dd3280b15b25b7a424b10b8
Author: Jan Tojnar <jtojnar gmail com>
Date: Wed Jan 23 11:11:58 2019 +0100
build: fix ui validation
build-aux/ui-pre-validation.xsl | 40 ++++++++++++++++++++++++++++++++++++++++
data/meson.build | 15 ++++++++++++++-
default.nix | 6 +++---
3 files changed, 57 insertions(+), 4 deletions(-)
---
diff --git a/build-aux/ui-pre-validation.xsl b/build-aux/ui-pre-validation.xsl
new file mode 100644
index 0000000..5c1756d
--- /dev/null
+++ b/build-aux/ui-pre-validation.xsl
@@ -0,0 +1,40 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- BuohComicList -->
+ <xsl:template match="template[@parent = 'GtkBin']">
+ <object>
+ <!-- GtkBin is abstract -->
+ <xsl:attribute name="class">GtkWindow</xsl:attribute>
+ <xsl:apply-templates select="@*[name() != 'parent' and name() != 'class']|node()" />
+ </object>
+ </xsl:template>
+ <!-- Other templates -->
+ <xsl:template match="template[@parent != 'GtkBin']">
+ <object>
+ <xsl:attribute name="class">
+ <xsl:value-of select="@parent"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="@*[name() != 'parent' and name() != 'class']|node()" />
+ </object>
+ </xsl:template>
+
+ <!-- Usage of custom elements -->
+ <xsl:template match="object/@class[. = 'BuohView']">
+ <!-- GtkBin is abstract -->
+ <xsl:attribute name="class">GtkWindow</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="object/@class[. = 'BuohComicList']">
+ <xsl:attribute name="class">GtkNotebook</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="object/@class[. = 'BuohViewComic']">
+ <xsl:attribute name="class">GtkViewport</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="object/@class[. = 'BuohViewMessage']">
+ <xsl:attribute name="class">GtkViewport</xsl:attribute>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/data/meson.build b/data/meson.build
index 87c8bf4..b17beee 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -8,12 +8,25 @@ ui_files = files(
'ui/view-message.ui',
'ui/window.ui',
)
+xsltproc = find_program('xsltproc')
if gtk_builder_tool.found()
foreach ui : ui_files
+ # gtk-builder-tool validate does not support custom widgets
+ ui_for_validation = configure_file(
+ input: ui,
+ output: '@PLAINNAME@',
+ command: [
+ xsltproc,
+ join_paths(meson.source_root(), 'build-aux', 'ui-pre-validation.xsl'),
+ '@INPUT@',
+ ],
+ capture: true,
+ )
+
test(
'Validating @0@'.format(ui),
gtk_builder_tool,
- args: ['validate', ui],
+ args: ['validate', ui_for_validation],
workdir: meson.current_build_dir(),
)
endforeach
diff --git a/default.nix b/default.nix
index 2f61ef6..a9530cd 100644
--- a/default.nix
+++ b/default.nix
@@ -23,8 +23,8 @@
{ pkgs ?
(import (fetchTarball {
- url = "https://github.com/NixOS/nixpkgs/archive/4477cf04b6779a537cdb5f0bd3dd30e75aeb4a3b.tar.gz";
- sha256 = "1i39wsfwkvj9yryj8di3jibpdg3b3j86ych7s9rb6z79k08yaaxc";
+ url = "https://github.com/NixOS/nixpkgs/archive/1b3affcbaa8e31af0bfe1be280f91ac3e384d96f.tar.gz";
+ sha256 = "0b7spivfa1fd07ch4plakp3j16pq9rjsg2ird3kz2sg86cwhhkcv";
}) {})
, doCheck ? true
, shell ? false
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
name = "buoh";
nativeBuildInputs = [
- meson ninja pkgconfig gettext python3 xvfb_run wrapGAppsHook
+ meson ninja pkgconfig gettext python3 xvfb_run libxslt wrapGAppsHook
];
buildInputs = [
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]