[gedit/tchaik/174-validate-gschema] build: Validate gschema files



commit 57355fb39735eebab326b773883944c658fda452
Author: Martin Blanchard <tchaik gmx com>
Date:   Mon Sep 16 23:28:58 2019 +0200

    build: Validate gschema files
    
    https://gitlab.gnome.org/GNOME/gedit/issues/174

 data/meson.build                  | 47 +++++++++++++++++++++++++++++----------
 plugins/externaltools/meson.build | 16 +++++++++++--
 plugins/filebrowser/meson.build   | 16 +++++++++++--
 plugins/pythonconsole/meson.build | 16 +++++++++++--
 plugins/spell/meson.build         | 16 +++++++++++--
 plugins/time/meson.build          | 16 +++++++++++--
 6 files changed, 105 insertions(+), 22 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 1eb35223e..ca3d0e1d4 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -20,14 +20,18 @@ appdata_file = i18n.merge_file(
     'metainfo',
   )
 )
+
 appstream_util = find_program('appstream-util', required: false)
 if appstream_util.found()
-test(
-    'validate-appdata', appstream_util,
+  test(
+    'validate-appdata',
+    appstream_util,
     args: [
-        'validate-relax', '--nonet', appdata_file.full_path()
+      'validate-relax',
+      '--nonet',
+      appdata_file.full_path()
     ]
-)
+  )
 endif
 
 
@@ -54,15 +58,16 @@ desktop_file = i18n.merge_file(
     'applications',
   )
 )
+
 desktop_file_validate = find_program('desktop-file-validate', required: false)
 if desktop_file_validate.found()
-test(
+  test(
     'validate-desktop',
     desktop_file_validate,
     args: [
-        desktop_file.full_path()
+      desktop_file.full_path(),
     ]
-)
+  )
 endif
 
 quoted_plugins = []
@@ -72,14 +77,14 @@ foreach plugin_name:active_plugins
   ]
 endforeach
 
-gschema_xml = configuration_data()
-gschema_xml.set('GETTEXT_PACKAGE', package_name)
-gschema_xml.set('ACTIVE_PLUGINS', ', '.join(quoted_plugins))
+gschema_in = configuration_data()
+gschema_in.set('GETTEXT_PACKAGE', package_name)
+gschema_in.set('ACTIVE_PLUGINS', ', '.join(quoted_plugins))
 
-configure_file(
+gschema_file = configure_file(
   input: 'org.gnome.gedit.gschema.xml.in',
   output: 'org.gnome.gedit.gschema.xml',
-  configuration: gschema_xml,
+  configuration: gschema_in,
   install: true,
   install_dir: join_paths(
     glibdir,
@@ -87,6 +92,24 @@ configure_file(
   )
 )
 
+gschema_dtd = join_paths(
+  gio_dep.get_pkgconfig_variable('schemasdir'),
+  'gschema.dtd',
+)
+
+xmllint = find_program('xmllint', required: false)
+if xmllint.found()
+  test(
+    'validate-gschema',
+    xmllint,
+    args: [
+      '--noout',
+      '--dtdvalid', gschema_dtd,
+      gschema_file,
+    ]
+  )
+endif
+
 service_in = configuration_data()
 service_in.set('bindir', bindir)
 
diff --git a/plugins/externaltools/meson.build b/plugins/externaltools/meson.build
index cc05c1267..617170e55 100644
--- a/plugins/externaltools/meson.build
+++ b/plugins/externaltools/meson.build
@@ -2,10 +2,10 @@ subdir('scripts')
 subdir('tools')
 subdir('data')
 
-configure_file(
+externaltools_gschema_file = configure_file(
   input: 'org.gnome.gedit.plugins.externaltools.gschema.xml.in',
   output: 'org.gnome.gedit.plugins.externaltools.gschema.xml',
-  configuration: gschema_xml,
+  configuration: gschema_in,
   install: true,
   install_dir: join_paths(
     glibdir,
@@ -13,6 +13,18 @@ configure_file(
   )
 )
 
+if xmllint.found()
+  test(
+    'validate-externaltools-gschema',
+    xmllint,
+    args: [
+      '--noout',
+      '--dtdvalid', gschema_dtd,
+      externaltools_gschema_file,
+    ]
+  )
+endif
+
 custom_target(
   'externaltools.plugin',
   input: 'externaltools.plugin.desktop.in',
diff --git a/plugins/filebrowser/meson.build b/plugins/filebrowser/meson.build
index 94a4ab0a6..bff9cfc3e 100644
--- a/plugins/filebrowser/meson.build
+++ b/plugins/filebrowser/meson.build
@@ -101,10 +101,10 @@ custom_target(
   )
 )
 
-configure_file(
+filebrowser_gschema_file = configure_file(
   input: 'org.gnome.gedit.plugins.filebrowser.gschema.xml.in',
   output: 'org.gnome.gedit.plugins.filebrowser.gschema.xml',
-  configuration: gschema_xml,
+  configuration: gschema_in,
   install: true,
   install_dir: join_paths(
     glibdir,
@@ -112,6 +112,18 @@ configure_file(
   )
 )
 
+if xmllint.found()
+  test(
+    'validate-filebrowser-gschema',
+    xmllint,
+    args: [
+      '--noout',
+      '--dtdvalid', gschema_dtd,
+      filebrowser_gschema_file,
+    ]
+  )
+endif
+
 custom_target(
   'filebrowser.plugin',
   input: 'filebrowser.plugin.desktop.in',
diff --git a/plugins/pythonconsole/meson.build b/plugins/pythonconsole/meson.build
index 0e4b1a5cb..b6b66b9f5 100644
--- a/plugins/pythonconsole/meson.build
+++ b/plugins/pythonconsole/meson.build
@@ -1,9 +1,9 @@
 subdir('pythonconsole')
 
-configure_file(
+pythonconsole_gschema_file = configure_file(
   input: 'org.gnome.gedit.plugins.pythonconsole.gschema.xml.in',
   output: 'org.gnome.gedit.plugins.pythonconsole.gschema.xml',
-  configuration: gschema_xml,
+  configuration: gschema_in,
   install: true,
   install_dir: join_paths(
     glibdir,
@@ -11,6 +11,18 @@ configure_file(
   )
 )
 
+if xmllint.found()
+  test(
+    'validate-pythonconsole-gschema',
+    xmllint,
+    args: [
+      '--noout',
+      '--dtdvalid', gschema_dtd,
+      pythonconsole_gschema_file,
+    ]
+  )
+endif
+
 custom_target(
   'pythonconsole.plugin',
   input: 'pythonconsole.plugin.desktop.in',
diff --git a/plugins/spell/meson.build b/plugins/spell/meson.build
index f89cef785..856448f29 100644
--- a/plugins/spell/meson.build
+++ b/plugins/spell/meson.build
@@ -28,10 +28,10 @@ libspell_sha = shared_module(
   name_suffix: module_suffix,
 )
 
-configure_file(
+spell_gschema_file = configure_file(
   input: 'org.gnome.gedit.plugins.spell.gschema.xml.in',
   output: 'org.gnome.gedit.plugins.spell.gschema.xml',
-  configuration: gschema_xml,
+  configuration: gschema_in,
   install: true,
   install_dir: join_paths(
     glibdir,
@@ -39,6 +39,18 @@ configure_file(
   )
 )
 
+if xmllint.found()
+  test(
+    'validate-spell-gschema',
+    xmllint,
+    args: [
+      '--noout',
+      '--dtdvalid', gschema_dtd,
+      spell_gschema_file,
+    ]
+  )
+endif
+
 custom_target(
   'spell.plugin',
   input: 'spell.plugin.desktop.in',
diff --git a/plugins/time/meson.build b/plugins/time/meson.build
index 4294abc61..0c60f5933 100644
--- a/plugins/time/meson.build
+++ b/plugins/time/meson.build
@@ -42,10 +42,10 @@ libtime_sha = shared_module(
   name_suffix: module_suffix,
 )
 
-configure_file(
+time_gschema_file = configure_file(
   input: 'org.gnome.gedit.plugins.time.gschema.xml.in',
   output: 'org.gnome.gedit.plugins.time.gschema.xml',
-  configuration: gschema_xml,
+  configuration: gschema_in,
   install: true,
   install_dir: join_paths(
     glibdir,
@@ -53,6 +53,18 @@ configure_file(
   )
 )
 
+if xmllint.found()
+  test(
+    'validate-time-gschema',
+    xmllint,
+    args: [
+      '--noout',
+      '--dtdvalid', gschema_dtd,
+      time_gschema_file,
+    ]
+  )
+endif
+
 custom_target(
   'time.plugin',
   input: 'time.plugin.desktop.in',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]