Merge branch 'ewlsh/refactor-gir-generation' into 'main'

Refactor GIRepository GIR generation to avoid cyclical dependency

See merge request GNOME/glib!3797
This commit is contained in:
Philip Withnall 2024-01-31 11:05:32 +00:00
commit b862fe077a
5 changed files with 38 additions and 37 deletions

View File

@ -157,3 +157,30 @@ gio_gir = gnome.generate_gir(libgio,
env: gi_gen_env_variables,
extra_args: gir_args + gio_gir_args,
)
libgirepository_gir_sources = [
gi_visibility_h,
girepo_headers,
girepo_sources,
]
libgirepository_gir_packages = [ 'girepository-2.0' ]
libgirepository_gir_args = [
'-DGI_COMPILATION',
'--symbol-prefix=gi',
'--identifier-prefix=GI',
]
girepository_gir = gnome.generate_gir(libgirepository,
sources: libgirepository_gir_sources,
namespace: 'GIRepository',
nsversion: '3.0',
identifier_prefix: 'GI',
symbol_prefix: 'gi',
export_packages: libgirepository_gir_packages,
header: 'girepository/girepository.h',
includes: [ glib_gir[0], gmodule_gir[0], gobject_gir[0], gio_gir[0] ],
install: true,
dependencies: [ libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep ],
extra_args: gir_args + libgirepository_gir_args,
)

View File

@ -235,31 +235,7 @@ pkg.generate(libgirepository,
)
if enable_gir
libgirepository_gir_sources = [
gi_visibility_h,
girepo_headers,
girepo_sources,
]
libgirepository_gir_packages = [ 'girepository-2.0' ]
libgirepository_gir_args = [
'-DGI_COMPILATION',
'--symbol-prefix=gi',
'--identifier-prefix=GI',
]
girepository_gir = gnome.generate_gir(libgirepository,
sources: libgirepository_gir_sources,
namespace: 'GIRepository',
nsversion: '3.0',
identifier_prefix: 'GI',
symbol_prefix: 'gi',
export_packages: libgirepository_gir_packages,
header: 'girepository/girepository.h',
includes: [ glib_gir[0], gmodule_gir[0], gobject_gir[0], gio_gir[0] ],
install: true,
dependencies: [ libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep ],
extra_args: gir_args + libgirepository_gir_args,
)
subdir('introspection')
endif
if build_tests

View File

@ -1,18 +1,19 @@
girepository_tests = {}
girepository_tests = {
'cmph-bdz': {
'dependencies': [cmph_dep],
},
'gthash' : {
'dependencies': [girepo_gthash_dep],
},
}
# Some GIR files are needed to test against
# Some tests require GIR files to have been generated
if enable_gir
girepository_tests += {
'cmph-bdz': {
'dependencies': [cmph_dep],
},
'function-info' : {
'dependencies': [libffi_dep],
'depends': [glib_gir],
},
'gthash' : {
'dependencies': [girepo_gthash_dep],
},
'repository' : {
'depends': [glib_gir, gio_gir, gobject_gir],
},

View File

@ -46,7 +46,7 @@ repository_setup (RepositoryFixture *fx,
fx->repository = gi_repository_new ();
g_assert_nonnull (fx->repository);
fx->gobject_typelib_dir = g_test_build_filename (G_TEST_BUILT, "..", "..", "introspection", NULL);
fx->gobject_typelib_dir = g_test_build_filename (G_TEST_BUILT, "..", "introspection", NULL);
g_test_message ("Using GI_TYPELIB_DIR = %s", fx->gobject_typelib_dir);
gi_repository_prepend_search_path (fx->repository, fx->gobject_typelib_dir);

View File

@ -2532,9 +2532,6 @@ subdir('gobject')
subdir('gthread')
subdir('gmodule')
subdir('gio')
if enable_gir
subdir('introspection')
endif
subdir('girepository')
subdir('fuzzing')