[lightsoff/appdata-update: 3/3] meson: add tests to validate appdata/desktop files



commit 0e391c1bf839ebd9e8d806756ea796a5d13f82cc
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Fri Jan 18 23:34:21 2019 +0100

    meson: add tests to validate appdata/desktop files

 data/meson.build | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 05f5772..9a8afe0 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -11,7 +11,7 @@ install_data(['off.svg', 'on.svg', 'highlight.svg'],
 desktop = 'org.gnome.lightsoff.desktop'
 
 # Desktop file
-i18n.merge_file(
+desktop_file = i18n.merge_file(
   input: desktop + '.in',
   output: desktop,
   type: 'desktop',
@@ -19,17 +19,37 @@ i18n.merge_file(
   install: true,
   install_dir: join_paths(datadir, 'applications'),
 )
+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
+
 
 appdata = 'org.gnome.lightsoff.appdata.xml'
 
 # Appdata
-i18n.merge_file(
+appdata_file = i18n.merge_file(
   input: appdata + '.in',
   output: appdata,
   po_dir: podir,
   install: true,
   install_dir: join_paths(datadir, 'metainfo')
 )
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+  test(
+    'validate-appdata', appstream_util,
+    args: [
+      'validate-relax', '--nonet', appdata_file.full_path()
+    ]
+  )
+endif
 
 # Gschema
 install_data('org.gnome.lightsoff.gschema.xml',


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