[gnome-clocks/bilelmoussaoui/meson-cleanup: 3/3] Meson: add tests to validate desktop, appdata & schemas
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/bilelmoussaoui/meson-cleanup: 3/3] Meson: add tests to validate desktop, appdata & schemas
- Date: Sun, 22 Sep 2019 18:27:34 +0000 (UTC)
commit b35616735fc341fae2cd717b482f265dbc69096b
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Sun Sep 22 20:27:03 2019 +0200
Meson: add tests to validate desktop, appdata & schemas
This will allow force us to keep those files valid.
data/meson.build | 53 ++++++++++++++++++++++++++++++++++++++++++++---------
meson_options.txt | 3 ++-
2 files changed, 46 insertions(+), 10 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index edd4f85..1418d97 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -19,10 +19,10 @@ resources = gnome.compile_resources('org.gnome.clocks', resource_files,
desktop_conf = configuration_data()
desktop_conf.set('icon', app_id)
-custom_target('desktop-file',
+desktop_file = custom_target('desktop-file',
input: configure_file(
input: 'org.gnome.clocks.desktop.in.in',
- output: 'org.gnome.clocks.desktop.in',
+ output: '@BASENAME@',
configuration: desktop_conf
),
output: '@0@.desktop'.format(app_id),
@@ -34,6 +34,18 @@ custom_target('desktop-file',
'--keyword=Name', '--keyword=GenericName', '--keyword=Comment', '--keyword=Keywords'
]
)
+# 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
+
dbusconf = configuration_data()
dbusconf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
@@ -48,18 +60,29 @@ configure_file(
appdata_conf = configuration_data()
appdata_conf.set('appid', app_id)
-custom_target('appdata-file',
+appdata_file = i18n.merge_file (
input: configure_file(
input: 'org.gnome.clocks.appdata.xml.in.in',
- output: 'org.gnome.clocks.appdata.xml.in',
- configuration: appdata_conf,
+ output: '@BASENAME@',
+ configuration: appdata_conf
),
output: '@0 appdata xml'.format(app_id),
+ po_dir: podir,
install: true,
- install_dir: join_paths(get_option('datadir'), 'metainfo'),
- command: [msgfmt, '--xml', '--template', '@INPUT@', '-d', podir, '-o', '@OUTPUT@'],
+ install_dir: join_paths(get_option('datadir'), 'metainfo')
)
+# 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
+
search_conf = configuration_data()
search_conf.set('appid', app_id)
search_conf.set('profile', profile)
@@ -75,8 +98,20 @@ gsettingsconf = configuration_data()
gsettingsconf.set('GETTEXT_PACKAGE', meson.project_name())
configure_file(
input: 'org.gnome.clocks.gschema.xml.in',
- output: 'org.gnome.clocks.gschema.xml',
+ output: '@BASENAME@',
configuration: gsettingsconf,
install: true,
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
-)
\ No newline at end of file
+)
+
+glib_compile_schemas = find_program('glib-compile-schemas', required: false)
+# Validata GSchema
+if glib_compile_schemas.found()
+ test(
+ 'validate-gschema', glib_compile_schemas,
+ args: [
+ '--strict', '--dry-run', meson.current_source_dir()
+ ]
+ )
+endif
+
diff --git a/meson_options.txt b/meson_options.txt
index 7469421..3f62c34 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -5,5 +5,6 @@ option(
'default',
'development',
],
- value: 'default'
+ value: 'default',
+ description: 'The build profile for Clock. One of "default" or "development".'
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]