[geary/wip/validate-app-data] Validate both appdata and desktop files



commit b605ddc409506c0aa7946e32ba9de7eb4f70f2a7
Author: Michael Gratton <mike vee net>
Date:   Sun Feb 24 22:08:48 2019 +1100

    Validate both appdata and desktop files
    
    Use same approach as
    https://gitlab.gnome.org/GNOME/nautilus/blob/master/data/meson.build#L112-138

 desktop/meson.build | 46 ++++++++++++++++++++++++++++++++++++++++------
 meson.build         |  4 +++-
 2 files changed, 43 insertions(+), 7 deletions(-)
---
diff --git a/desktop/meson.build b/desktop/meson.build
index 29f9ce74..12d1644f 100644
--- a/desktop/meson.build
+++ b/desktop/meson.build
@@ -1,5 +1,14 @@
-foreach desktop_file: [ 'org.gnome.Geary.desktop', 'geary-autostart.desktop' ]
-  i18n.merge_file(
+#
+# Desktop files
+#
+
+desktop_src = [
+  'org.gnome.Geary.desktop',
+  'geary-autostart.desktop'
+]
+
+foreach desktop_file: desktop_src
+  desktop_merged = i18n.merge_file(
     input: desktop_file + '.in',
     output: desktop_file,
     type: 'desktop',
@@ -7,19 +16,44 @@ foreach desktop_file: [ 'org.gnome.Geary.desktop', 'geary-autostart.desktop' ]
     install: true,
     install_dir: join_paths(datadir, 'applications')
   )
+  if desktop_file_validate.found()
+    test(
+      desktop_file + '-validate',
+      desktop_file_validate,
+      args: [ desktop_merged.full_path() ]
+    )
+  endif
 endforeach
 
-# The appdata file
-i18n.merge_file(
-  input: 'org.gnome.Geary.appdata.xml.in',
-  output: 'org.gnome.Geary.appdata.xml',
+#
+# Appdata file
+#
+
+appdata_file = 'org.gnome.Geary.appdata.xml'
+
+appdata_merged = i18n.merge_file(
+  input: appdata_file + '.in',
+  output: appdata_file,
   type: 'xml',
   po_dir: po_dir,
   install: true,
   install_dir: join_paths(datadir, 'metainfo')
 )
 
+if appstream_util.found()
+  test(
+    appdata_file + '-validate',
+    appstream_util,
+    args: [
+      'validate-relax', '--nonet', appdata_merged.full_path()
+    ]
+  )
+endif
+
+#
 # Contractor file (Elementary OS)
+#
+
 if install_contractor_file
   # Call msgfmt manually since gettext won't otherwise translate the
   # Description field. See merge req !50.
diff --git a/meson.build b/meson.build
index a1f76576..b83eb445 100644
--- a/meson.build
+++ b/meson.build
@@ -99,7 +99,9 @@ if libunwind_dep.found()
    )
 endif
 
-# Optional libraries
+# Optional dependencies
+appstream_util = find_program('appstream-util', required: false)
+desktop_file_validate = find_program('desktop-file-validate', required: false)
 libunity = dependency('unity', version: '>= 5.12.0', required: false)
 libmessagingmenu = meson.get_compiler('c').find_library('libmessaging-menu', required: false)
 


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