[gnome-builder] gsettings: generate gschema.compiled for unit tests



commit fbad579de452a38a97c88df5d804ae672f7bcc60
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 25 18:25:51 2018 -0700

    gsettings: generate gschema.compiled for unit tests
    
    This hopefully fixes some automated build systems that are running unit
    tests as part of the build process.
    
    Fixes #640

 data/gsettings/meson.build | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/data/gsettings/meson.build b/data/gsettings/meson.build
index b8b2c8028..49de09221 100644
--- a/data/gsettings/meson.build
+++ b/data/gsettings/meson.build
@@ -1,4 +1,5 @@
 schema_dir = join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
+schema_files = []
 
 # Perhaps this should be moved to the plugin
 ctags_path = get_option('ctags_path')
@@ -17,15 +18,15 @@ endif
 schema_conf = configuration_data()
 schema_conf.set('ECTAGS', ctags_path)
 
-configure_file(
+schema_files += [configure_file(
           input: 'org.gnome.builder.code-insight.gschema.xml.in',
          output: 'org.gnome.builder.code-insight.gschema.xml',
   configuration: schema_conf,
         install: true,
     install_dir: schema_dir,
-)
+)]
 
-install_data([
+schemas = [
   'org.gnome.builder.build.gschema.xml',
   'org.gnome.builder.editor.gschema.xml',
   'org.gnome.builder.editor.language.gschema.xml',
@@ -36,4 +37,26 @@ install_data([
   'org.gnome.builder.project-tree.gschema.xml',
   'org.gnome.builder.terminal.gschema.xml',
   'org.gnome.builder.workbench.gschema.xml',
-], install_dir: schema_dir)
+]
+
+# HACK: We need access to all schemas when running tests, so we
+#       need to copy them to the build dir (since the .in file
+#       will also end up there).
+
+foreach schema : schemas
+  schema_files += [configure_file(
+          input: schema,
+         output: schema,
+           copy: true,
+        install: true,
+    install_dir: schema_dir,
+  )]
+endforeach
+
+gschemas_compiled = custom_target('gschemas.compiled',
+            output: 'gschemas.compiled',
+           command: ['glib-compile-schemas', meson.current_build_dir()],
+      depend_files: schema_files,
+  build_by_default: true,
+           install: false,
+)


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