diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 0112ab17c..e503ee921 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -1570,11 +1570,11 @@ class GnomeModule(ExtensionModule): def gtkdoc_html_dir(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'TYPE_kwargs') -> str: return os.path.join('share/gtk-doc/html', args[0]) - @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File)]) + @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)]) @typed_kwargs( 'gnome.gdbus_codegen', _BUILD_BY_DEFAULT.evolve(since='0.40.0'), - KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File)), since='0.46.0', default=[], listify=True), + KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)), since='0.46.0', default=[], listify=True), KwargInfo('extra_args', ContainerTypeInfo(list, str), since='0.47.0', default=[], listify=True), KwargInfo('interface_prefix', (str, NoneType)), KwargInfo('namespace', (str, NoneType)), @@ -1592,10 +1592,10 @@ class GnomeModule(ExtensionModule): validator=in_set_validator({'all', 'none', 'objects'})), INSTALL_DIR_KW.evolve(since='0.46.0') ) - def gdbus_codegen(self, state: 'ModuleState', args: T.Tuple[str, T.Optional['FileOrString']], + def gdbus_codegen(self, state: 'ModuleState', args: T.Tuple[str, T.Optional[T.Union['FileOrString', build.GeneratedTypes]]], kwargs: 'GdbusCodegen') -> ModuleReturnValue: namebase = args[0] - xml_files: T.List['FileOrString'] = [args[1]] if args[1] else [] + xml_files: T.List[T.Union['FileOrString', build.GeneratedTypes]] = [args[1]] if args[1] else [] cmd: T.List[T.Union['ExternalProgram', str]] = [state.find_program('gdbus-codegen')] cmd.extend(kwargs['extra_args']) diff --git a/test cases/frameworks/7 gnome/resources/copyfile.py b/test cases/frameworks/7 gnome/copyfile.py similarity index 100% rename from test cases/frameworks/7 gnome/resources/copyfile.py rename to test cases/frameworks/7 gnome/copyfile.py diff --git a/test cases/frameworks/7 gnome/gdbus/meson.build b/test cases/frameworks/7 gnome/gdbus/meson.build index 682abfffe..d749033e9 100644 --- a/test cases/frameworks/7 gnome/gdbus/meson.build +++ b/test cases/frameworks/7 gnome/gdbus/meson.build @@ -58,6 +58,27 @@ else includes = include_directories('..') endif +# check that custom targets work +gdbus_xml_ct = custom_target('built xml sources for gdbus', + output: 'com.example.SampleCustomTarget.xml', + input: 'data/com.example.Sample.xml', + command : [copyfile, '@INPUT@', '@OUTPUT@']) + +gdbus_src_ct = gnome.gdbus_codegen( + 'generated-gdbus-customtarget-src', + gdbus_xml_ct, + interface_prefix : 'com.example.', + namespace : 'Sample', + annotations : [], +) +gdbus_src_cti = gnome.gdbus_codegen( + 'generated-gdbus-customtargetindex-src', + gdbus_xml_ct[0], + interface_prefix : 'com.example.', + namespace : 'Sample', + annotations : [], +) + gdbus_exe = executable('gdbus-test', 'gdbusprog.c', gdbus_src, include_directories : includes, diff --git a/test cases/frameworks/7 gnome/meson.build b/test cases/frameworks/7 gnome/meson.build index 9f8640609..920bc6a82 100644 --- a/test cases/frameworks/7 gnome/meson.build +++ b/test cases/frameworks/7 gnome/meson.build @@ -1,5 +1,7 @@ project('gobject-introspection', 'c') +copyfile = find_program('copyfile.py') + glib = dependency('glib-2.0', required: false) if not glib.found() error('MESON_SKIP_TEST glib not found.') diff --git a/test cases/frameworks/7 gnome/resources/meson.build b/test cases/frameworks/7 gnome/resources/meson.build index 180b33851..60fc8481e 100644 --- a/test cases/frameworks/7 gnome/resources/meson.build +++ b/test cases/frameworks/7 gnome/resources/meson.build @@ -1,8 +1,6 @@ # There are two tests here, because the 2nd one depends on a version of # GLib (2.51.1) that is very recent at the time of writing. -copyfile = find_program('copyfile.py') - simple_gresource = configure_file( input : 'simple.gresource.xml', output : 'simple-gen.gresource.xml',