[totem/bilelmoussaoui/meson-tests] Meson: add tests to validate schema/desktop/appdata files



commit 53b55d3884b2560228fefc6f7e488f2c64a77a05
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Wed Sep 25 19:53:05 2019 +0200

    Meson: add tests to validate schema/desktop/appdata files
    
    The flatpak CI template already runs ninja tests for us.
    Let's use that to ensure the appdata/desktop/schema files are always valid

 data/appdata/meson.build | 12 +++++++++++-
 data/meson.build         | 23 ++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
index 7f82d374d..a66f1921b 100644
--- a/data/appdata/meson.build
+++ b/data/appdata/meson.build
@@ -1,8 +1,18 @@
 appdata = 'org.gnome.Totem.appdata.xml'
 
-i18n.merge_file ('appdata',
+appdata_file = i18n.merge_file ('appdata',
                  input: appdata + '.in',
                  output: appdata,
                  install: true,
                  install_dir: join_paths(totem_datadir, 'metainfo'),
                  po_dir: po_dir,)
+# Validate Appdata
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+  test(
+    'validate-appdata', appstream_util,
+    args: [
+      'validate', '--nonet', appdata_file.full_path()
+    ]
+  )
+endif
diff --git a/data/meson.build b/data/meson.build
index 6cb83f4b6..ab44aba88 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -68,7 +68,7 @@ desktop_in = configure_file(
   configuration: desktop_conf
 )
 
-i18n.merge_file (
+desktop_file = i18n.merge_file (
   desktop,
   type: 'desktop',
   input: desktop_in,
@@ -77,6 +77,17 @@ i18n.merge_file (
   install: true,
   install_dir: join_paths(totem_datadir, 'applications')
 )
+# Validate Desktop file
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+if desktop_file_validate.found()
+  test(
+    'validate-desktop',
+    desktop_file_validate,
+    args: [
+      desktop_file.full_path()
+    ]
+  )
+endif
 
 service_conf = configuration_data()
 service_conf.set('bindir', totem_bindir)
@@ -158,6 +169,16 @@ configure_file(
   install_dir: totem_schemadir,
   configuration: schema_conf
 )
+# Validata GSchema
+glib_compile_schemas = find_program('glib-compile-schemas', required: false)
+if glib_compile_schemas.found()
+  test(
+    'validate-gschema', glib_compile_schemas,
+    args: [
+      '--strict', '--dry-run', meson.current_source_dir()
+    ]
+  )
+endif
 
 install_data(
   'totem.convert',


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