[gnome-builder/wip/gtk4-port: 1455/1774] build: hoist test setup into src




commit 80f51fced0c1d462eaa9ca25dbdc82b382d2d291
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 10 12:48:17 2022 -0700

    build: hoist test setup into src
    
    This makes it a bit easier to reference some things without forcing tests
    to be added before we do gir generation.

 src/meson.build       | 37 ++++++++++++++++++++++++++++++++++++-
 src/tests/meson.build | 39 ---------------------------------------
 2 files changed, 36 insertions(+), 40 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index eadd3a96c..c9a44e418 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -17,8 +17,40 @@ gnome_builder_gir_extra_args = []
 exe_link_args = []
 exe_c_args = []
 
+# Setup variables for some libide tests early
+test_gi_typelib_path = ['@0@/src'.format(meson.project_build_root())]
+test_typelib_deps = [
+  libadwaita_dep,
+  libgio_dep,
+  libgtk_dep,
+  libgtksource_dep,
+  libjson_glib_dep,
+  libjsonrpc_glib_dep,
+  libpanel_dep,
+  libpeas_dep,
+  libtemplate_glib_dep,
+  libvte_dep,
+]
+foreach test_typelib_dep: test_typelib_deps
+  test_gi_typelib_path += [join_paths(test_typelib_dep.get_variable('libdir'), 'girepository-1.0')]
+endforeach
+test_env = [
+  'GI_TYPELIB_PATH=@0@'.format(':'.join(test_gi_typelib_path)),
+  'G_TEST_SRCDIR=@0@/tests'.format(meson.current_source_dir()),
+  'G_TEST_BUILDDIR=@0@/tests'.format(meson.current_build_dir()),
+  'G_DEBUG=gc-friendly',
+  'GSETTINGS_BACKEND=memory',
+  'GSETTINGS_SCHEMA_DIR=@0@/data/gsettings'.format(meson.project_build_root()),
+  'PYTHONDONTWRITEBYTECODE=yes',
+  'MALLOC_CHECK_=2',
+  'NO_AT_BRIDGE=1',
+]
+test_cflags = [
+  '-DTEST_DATA_DIR="@0@/tests/data/"'.format(meson.current_source_dir()),
+  '-I' + join_paths(meson.project_source_root(), 'src'),
+]
+
 subdir('libide')
-subdir('tests')
 subdir('plugins')
 
 gnome_builder_deps = [
@@ -114,3 +146,6 @@ libide_gir = gnome.generate_gir(gnome_builder,
   install_dir_typelib: pkgtypelibdir,
            extra_args: gnome_builder_gir_extra_args,
 )
+
+# tests last so they can reference libide_gir as test(depends:)
+subdir('tests')
diff --git a/src/tests/meson.build b/src/tests/meson.build
index 5d5c8cfbe..c6e7c1e62 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -1,42 +1,3 @@
-gi_typelib_path = [
-  '@0@/src'.format(meson.project_build_root()),
-]
-
-typelib_deps = [
-  libadwaita_dep,
-  libgio_dep,
-  libgtk_dep,
-  libgtksource_dep,
-  libjson_glib_dep,
-  libjsonrpc_glib_dep,
-  libpanel_dep,
-  libpeas_dep,
-  libtemplate_glib_dep,
-  libvte_dep,
-]
-
-foreach typelib_dep: typelib_deps
-  gi_typelib_path += [join_paths(typelib_dep.get_variable('libdir'), 'girepository-1.0')]
-endforeach
-
-test_env = [
-  'GI_TYPELIB_PATH=@0@'.format(':'.join(gi_typelib_path)),
-  'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-  'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
-  'G_DEBUG=gc-friendly',
-  'GSETTINGS_BACKEND=memory',
-  'GSETTINGS_SCHEMA_DIR=@0@/data/gsettings'.format(meson.project_build_root()),
-  'PYTHONDONTWRITEBYTECODE=yes',
-  'MALLOC_CHECK_=2',
-  'NO_AT_BRIDGE=1',
-]
-
-test_cflags = [
-  '-DTEST_DATA_DIR="@0@/data/"'.format(meson.current_source_dir()),
-  '-I' + join_paths(meson.project_source_root(), 'src'),
-]
-
-
 test_libide_core = executable('test-libide-core', 'test-libide-core.c',
         c_args: test_cflags,
   dependencies: [ libide_core_dep ],


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