summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2018-04-10 18:19:05 +0200
committerBenjamin Berg <bberg@redhat.com>2018-04-10 23:22:01 +0200
commitc5665d3e6547e21d57564abbbfcb01705e0a7744 (patch)
tree0094373e798d0f10bd9d0481d00213fec0e9a119
parented1683470f532193726d11775b7d5b3f02e1991f (diff)
downloadgnome-settings-daemon-c5665d3e6547e21d57564abbbfcb01705e0a7744.tar.gz
data: Compile gschema files at build time and copy into tests
Without this we need to install the GSchema files for testing purposes.
-rw-r--r--data/meson.build16
-rw-r--r--tests/gsdtestcase.py5
2 files changed, 18 insertions, 3 deletions
diff --git a/data/meson.build b/data/meson.build
index 5c4fb507..e93ba641 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -15,19 +15,20 @@ schemas = [
schema_conf = configuration_data()
schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
+schemas_xml = []
foreach schema: schemas
- configure_file(
+ schemas_xml += [configure_file(
input: schema + '.in',
output: schema,
configuration: schema_conf,
install: true,
install_dir: gsd_schemadir
- )
+ )]
endforeach
enums_header = files('gsd-enums.h')
-gnome.mkenums(
+mkenums = gnome.mkenums(
'org.gnome.settings-daemon.enums.xml',
sources: enums_header,
comments: '<!-- @comment@ -->',
@@ -57,3 +58,12 @@ pkg.generate(
filebase: meson.project_name(),
subdirs: gsd_api_name
)
+
+
+# for unit tests - gnome.compile_schemas() only looks in srcdir
+custom_target('compile-schemas',
+ input: schemas_xml,
+ depends: mkenums,
+ output: 'gschemas.compiled',
+ command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
+ build_by_default: true)
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py
index a3515c07..20bab9e0 100644
--- a/tests/gsdtestcase.py
+++ b/tests/gsdtestcase.py
@@ -69,6 +69,11 @@ class GSDTestCase(X11SessionTestCase):
os.environ['XDG_DATA_HOME'] = os.path.join(klass.workdir, 'data')
os.environ['XDG_RUNTIME_DIR'] = os.path.join(klass.workdir, 'runtime')
+ # Copy gschema file into XDG_DATA_HOME
+ gschema_dir = os.path.join(os.environ['XDG_DATA_HOME'], 'glib-2.0', 'schemas')
+ os.makedirs(gschema_dir)
+ shutil.copy(os.path.join(top_builddir, 'data', 'gschemas.compiled'), gschema_dir)
+
# work around https://bugzilla.gnome.org/show_bug.cgi?id=689136
os.makedirs(os.path.join(os.environ['XDG_CONFIG_HOME'], 'dconf'))
os.makedirs(os.environ['XDG_RUNTIME_DIR'], mode=0o700)