[geary/mjog/composer-context-loading-fixes: 8/19] build: Generate client internal VAPI and build client tests with it
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/composer-context-loading-fixes: 8/19] build: Generate client internal VAPI and build client tests with it
- Date: Thu, 13 Aug 2020 09:52:25 +0000 (UTC)
commit 6e0aa316d8e5cf0ab60ed6c2da16435d014f26f0
Author: Michael Gratton <mike vee net>
Date: Mon Aug 10 18:07:16 2020 +1000
build: Generate client internal VAPI and build client tests with it
src/client/meson.build | 52 +++++++++++++++++++++++++++++++++++++++++++++++++-
test/meson.build | 3 ++-
test/test-client.vala | 4 ----
3 files changed, 53 insertions(+), 6 deletions(-)
---
diff --git a/src/client/meson.build b/src/client/meson.build
index 2c530049b..1c630d16f 100644
--- a/src/client/meson.build
+++ b/src/client/meson.build
@@ -170,6 +170,21 @@ client_dependencies = [
webkit2gtk,
]
+client_build_dir = meson.current_build_dir()
+
+# Generate internal VAPI for unit testing. See Meson issue
+# https://github.com/mesonbuild/meson/issues/1781 for official
+# internal VAPI support.
+client_vala_args = geary_vala_args
+client_vala_args += [
+ '--internal-header=@0@/@1@-internal.h'.format(
+ client_build_dir, client_package_name
+ ),
+ '--internal-vapi=@0@/@1 -internal vapi'.format(
+ client_build_dir, client_package_name
+ )
+]
+
# Enable shared shecondary process if available.
# See issues #558 and #559
webkit_version = webkit2gtk.version().split('.')
@@ -192,9 +207,44 @@ client_lib = shared_library(
install_dir: client_lib_dir,
)
+# Dummy target to tell Meson about the internal VAPI given the
+# workaround above, and fix the VAPI header to work around
+# GNOME/vala#358
+client_internal_header_fixup = custom_target(
+ 'client_internal_header_fixup',
+ output: [
+ 'geary-client-internal.h',
+ 'geary-client-internal.vapi',
+ ],
+ command: [
+ find_program('sed'),
+ '-ibak',
+ 's/@0@.h/geary-client-internal.h/g'.format(client_package),
+ '@OUTDIR@/geary-client-internal.vapi',
+ ],
+ depends: client_lib
+)
+
client_dep = declare_dependency(
- link_with: client_lib,
+ link_with: [
+ client_lib,
+ sqlite3_unicodesn_lib
+ ],
+ include_directories: include_directories('.')
+)
+
+client_internal_dep = declare_dependency(
+ # Can't just include client_lib in link_with since that will
+ # pull in the public header and we get duplicate symbol errors.
+ link_args: [
+ '-L' + client_build_dir,
+ '-l' + client_package
+ ],
+ link_with: [
+ sqlite3_unicodesn_lib,
+ ],
include_directories: include_directories('.'),
+ sources: client_internal_header_fixup
)
subdir('plugin')
diff --git a/test/meson.build b/test/meson.build
index 86977db09..21d453fae 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -133,7 +133,7 @@ test_engine_bin = executable('test-engine',
# Client tests
test_client_dependencies = [
- client_dep,
+ client_internal_dep,
vala_unit_dep,
]
test_client_dependencies += client_dependencies
@@ -144,6 +144,7 @@ test_client_bin = executable('test-client',
include_directories: config_h_dir,
vala_args: geary_vala_args,
c_args: geary_c_args,
+ build_rpath: client_build_dir,
)
# Integration tests
diff --git a/test/test-client.vala b/test/test-client.vala
index 762887782..02e98ba5a 100644
--- a/test/test-client.vala
+++ b/test/test-client.vala
@@ -6,10 +6,6 @@
*/
-extern const string _INSTALL_PREFIX;
-extern const string _BUILD_ROOT_DIR;
-extern const string _GSETTINGS_DIR;
-
int main(string[] args) {
/*
* Set env vars right up front to avoid weird bugs
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]