[gnome-tweaks/meson-tests] Meson: add tests to validate appdata/desktop file



commit 2ebc9d2be8ac9754f66c4434e4a073776a9c060c
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Mon Jan 21 12:40:36 2019 +0100

    Meson: add tests to validate appdata/desktop file
    
    This MR fixes my latest broken one.
    It also avoid this kind of issues by using a project_id var.

 data/meson.build | 42 +++++++++++++++++++++++++++++-------------
 meson.build      |  4 +++-
 2 files changed, 32 insertions(+), 14 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index c16d64a..b265cfd 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,21 +1,37 @@
-appdata_file = 'org.gnome.tweaks.appdata.xml'
-i18n.merge_file(appdata_file,
-  input: appdata_file + '.in',
-  output: appdata_file,
-  po_dir: '../po',
+appdata_file = i18n.merge_file(
+  'appdata',
+  input: project_id + '.appdata.xml.in',
+  output: project_id + '.appdata.xml',
+  po_dir: join_paths(meson.source_root(), 'po'),
   install: true,
   install_dir: appdatadir
 )
-
-desktop_file = 'org.gnome.tweaks.desktop'
-i18n.merge_file(desktop_file,
-  input: desktop_file + '.in',
-  output: desktop_file,
-  po_dir: '../po',
+appstream_util = find_program(['appstream-util'], required: false)
+if appstream_util.found()
+  test (
+    'Validate appdata file',
+    appstream_util,
+    args: ['validate', '--nonet', appdata_file.full_path()]
+  )
+endif
+desktop_file = i18n.merge_file(
+  'desktop',
+  input: project_id + '.desktop.in',
+  output: project_id + '.desktop',
+  po_dir: join_paths(meson.source_root(), 'po'),
   install: true,
   install_dir: desktopdir,
   type: 'desktop'
 )
+desktop_file_validate = find_program('desktop-file-validate', required:false)
+if desktop_file_validate.found()
+  test (
+    'Validate desktop file',
+    desktop_file_validate,
+    args: desktop_file.full_path()
+  )
+endif
+
 
 gui_data = [
   'shell.ui',
@@ -23,7 +39,7 @@ gui_data = [
 ]
 install_data(gui_data, install_dir: pkgdatadir)
 
-install_data ('org.gnome.tweaks.svg',
+install_data (project_id + '.svg',
   install_dir: join_paths(datadir, 'icons', 'hicolor', 'scalable', 'apps'))
-install_data ('org.gnome.tweaks-symbolic.svg',
+install_data (project_id + '-symbolic.svg',
   install_dir: join_paths(datadir, 'icons', 'hicolor', 'symbolic', 'apps'))
diff --git a/meson.build b/meson.build
index bd927ed..c4c08e4 100644
--- a/meson.build
+++ b/meson.build
@@ -1,8 +1,10 @@
 project('gnome-tweaks',
   version: '3.31.3',
-  meson_version: '>= 0.40.0'
+  meson_version: '>= 0.48.0'
 )
 
+project_id = 'org.gnome.tweaks'
+
 gnome = import('gnome')
 i18n = import('i18n')
 python3 = import('python3')


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