[tracker-miners/sam/test-runner-fix: 11/31] Compile gschemas in the build directory, for use by tests



commit 1761a9fe4cebcddc883bfa594c0e8f78af187d8f
Author: Sam Thursfield <sam afuera me uk>
Date:   Fri Jan 4 20:52:47 2019 +0100

    Compile gschemas in the build directory, for use by tests
    
    Allow running tests without the need to install the gsettings schemas.
    This commit moves all the gschemas in the data directory and compiles
    them in the build directory. Tests that require gschemas need to be
    launched with the proper GSETTINGS_SCHEMA_DIR env variable.
    
    Based on tracker.git commit c33c080c20dae1e60982, by Andrea Azzarone.

 data/meson.build                                   | 40 ++++++++++++++++++++++
 .../org.freedesktop.Tracker.Extract.gschema.xml.in |  0
 ....freedesktop.Tracker.Miner.Files.gschema.xml.in |  0
 ...rg.freedesktop.Tracker.Writeback.gschema.xml.in |  0
 meson.build                                        |  1 +
 src/miners/fs/meson.build                          |  7 ----
 src/tracker-extract/meson.build                    |  7 ----
 src/tracker-writeback/meson.build                  |  7 ----
 tests/functional-tests/meson.build                 |  1 +
 9 files changed, 42 insertions(+), 21 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 000000000..09f7cd4fe
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,40 @@
+schemas = [
+  'org.freedesktop.Tracker.Extract.gschema.xml',
+  'org.freedesktop.Tracker.Miner.Files.gschema.xml',
+  'org.freedesktop.Tracker.Writeback.gschema.xml',
+]
+
+compile_schema_deps = []
+
+foreach schema : schemas
+  schema_target = custom_target(schema,
+    input: schema + '.in',
+    output: schema,
+    command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: gsettings_schema_dir)
+  compile_schema_deps += schema_target
+endforeach
+
+tracker_miners_settings_enums = custom_target('tracker-miners-common-settings-enums',
+    input: '../src/libtracker-miners-common/tracker-enums.h',
+    output: 'org.freedesktop.TrackerMiners.enums.xml',
+    command: [glib_mkenums,
+              '--comments', '<!-- @comment@ -->',
+              '--fhead', '<schemalist>',
+              '--vhead', '<@type@ id="org.freedesktop.TrackerMiners.@EnumName@">',
+              '--vprod', '    <value nick="@valuenick@" value="@valuenum@"/>',
+              '--vtail', '  </@type@>',
+              '--ftail', '</schemalist>', '@INPUT@'],
+    capture: true,
+    install: true,
+    install_dir: gsettings_schema_dir)
+
+compile_schema_deps += [tracker_miners_settings_enums]
+
+# for unit tests
+custom_target('tracker-miners-compile-schemas',
+  output: 'gschemas.compiled',
+  command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
+  build_by_default: true,
+  depends: compile_schema_deps)
diff --git a/src/tracker-extract/org.freedesktop.Tracker.Extract.gschema.xml.in 
b/data/org.freedesktop.Tracker.Extract.gschema.xml.in
similarity index 100%
rename from src/tracker-extract/org.freedesktop.Tracker.Extract.gschema.xml.in
rename to data/org.freedesktop.Tracker.Extract.gschema.xml.in
diff --git a/src/miners/fs/org.freedesktop.Tracker.Miner.Files.gschema.xml.in 
b/data/org.freedesktop.Tracker.Miner.Files.gschema.xml.in
similarity index 100%
rename from src/miners/fs/org.freedesktop.Tracker.Miner.Files.gschema.xml.in
rename to data/org.freedesktop.Tracker.Miner.Files.gschema.xml.in
diff --git a/src/tracker-writeback/org.freedesktop.Tracker.Writeback.gschema.xml.in 
b/data/org.freedesktop.Tracker.Writeback.gschema.xml.in
similarity index 100%
rename from src/tracker-writeback/org.freedesktop.Tracker.Writeback.gschema.xml.in
rename to data/org.freedesktop.Tracker.Writeback.gschema.xml.in
diff --git a/meson.build b/meson.build
index 550001d2b..5045fd390 100644
--- a/meson.build
+++ b/meson.build
@@ -386,6 +386,7 @@ vapi_dir = join_paths(get_option('prefix'), get_option('datadir'), 'vala', 'vapi
 glib_mkenums = find_program('glib-mkenums')
 
 subdir('src')
+subdir('data')
 
 if get_option('docs')
   subdir('docs')
diff --git a/src/miners/fs/meson.build b/src/miners/fs/meson.build
index 288610b97..f96daa95d 100644
--- a/src/miners/fs/meson.build
+++ b/src/miners/fs/meson.build
@@ -58,13 +58,6 @@ desktop_file = custom_target('tracker-miner-fs-desktop-file',
     install: true,
     install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
 
-custom_target('tracker-miner-fs-settings-schema',
-    input: 'org.freedesktop.Tracker.Miner.Files.gschema.xml.in',
-    output: 'org.freedesktop.Tracker.Miner.Files.gschema.xml',
-    command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
-    install: true,
-    install_dir: gsettings_schema_dir)
-
 if install_systemd_user_services
   configure_file(
       input: 'tracker-miner-fs.service.in',
diff --git a/src/tracker-extract/meson.build b/src/tracker-extract/meson.build
index 2344ee9ff..0d8966c4c 100644
--- a/src/tracker-extract/meson.build
+++ b/src/tracker-extract/meson.build
@@ -198,13 +198,6 @@ desktop_file = custom_target('tracker-extract-desktop-file',
   install: true,
   install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
 
-custom_target('tracker-extract-settings-schema',
-  input: 'org.freedesktop.Tracker.Extract.gschema.xml.in',
-  output: 'org.freedesktop.Tracker.Extract.gschema.xml',
-  command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
-  install: true,
-  install_dir: gsettings_schema_dir)
-
 if install_systemd_user_services
   configure_file(
     input: 'tracker-extract.service.in',
diff --git a/src/tracker-writeback/meson.build b/src/tracker-writeback/meson.build
index f84eab579..ad3d86e0d 100644
--- a/src/tracker-writeback/meson.build
+++ b/src/tracker-writeback/meson.build
@@ -56,13 +56,6 @@ dbus_service_file = configure_file(
   install: true,
   install_dir: dbus_services_dir)
 
-custom_target('tracker-writeback-settings-schema',
-  input: 'org.freedesktop.Tracker.Writeback.gschema.xml.in',
-  output: 'org.freedesktop.Tracker.Writeback.gschema.xml',
-  command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
-  install: true,
-  install_dir: gsettings_schema_dir)
-
 if install_systemd_user_services
   configure_file(
     input: 'tracker-writeback.service.in',
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index aefacef5a..723866ea6 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -63,6 +63,7 @@ tracker_extractors_dir = join_paths(meson.current_build_dir(), '..', '..', 'src'
 
 test_env = environment()
 test_env.set('DCONF_PROFILE', dconf_profile_full_path)
+test_env.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
 
 test_env.set('TRACKER_DB_ONTOLOGIES_DIR', tracker_uninstalled_nepomuk_ontologies_dir)
 test_env.set('TRACKER_EXTRACTORS_DIR', tracker_extractors_dir)


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