|
|
26d557 |
From e03c6d8be0e07dc0a5295867acd3bcde8852d5ba Mon Sep 17 00:00:00 2001
|
|
|
26d557 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
26d557 |
Date: Wed, 5 Oct 2022 16:40:09 +0200
|
|
|
26d557 |
Subject: [PATCH 6/9] gnome: allow custom targets as gdbus-codegen inputs
|
|
|
26d557 |
Content-Type: text/plain
|
|
|
26d557 |
|
|
|
26d557 |
Custom targets as sources to `gnome.gdbus_codegen` worked until version 0.60
|
|
|
26d557 |
of Meson, but broke in 0.61 because of the conversion to typed_pos_args
|
|
|
26d557 |
and typed_kwargs. Reinstate this by adding custom targets to the
|
|
|
26d557 |
decorators and annotations.
|
|
|
26d557 |
|
|
|
26d557 |
While generators also used to work, they are a bit tricky because
|
|
|
26d557 |
gdbus_codegen desugars to two custom_targets and therefore the generator
|
|
|
26d557 |
is invoked twice. This should not be a problem, but be explicit and
|
|
|
26d557 |
leave that to a separate commit to highlight the problem.
|
|
|
26d557 |
|
|
|
26d557 |
Fixes: 53a187ba2 ("modules/gnome: use typed_pos_args for gdbus_codegen", 2021-11-01)
|
|
|
26d557 |
Fixes: ef52e6093 ("modules/gnome: use typed_kwargs for gdbus_codegen", 2021-11-08)
|
|
|
26d557 |
---
|
|
|
26d557 |
mesonbuild/modules/gnome.py | 8 +++----
|
|
|
26d557 |
test cases/frameworks/7 gnome/copyfile.py | 6 ++++++
|
|
|
26d557 |
.../frameworks/7 gnome/gdbus/meson.build | 21 +++++++++++++++++++
|
|
|
26d557 |
test cases/frameworks/7 gnome/meson.build | 2 ++
|
|
|
26d557 |
.../frameworks/7 gnome/resources/copyfile.py | 6 ------
|
|
|
26d557 |
.../frameworks/7 gnome/resources/meson.build | 2 --
|
|
|
26d557 |
6 files changed, 33 insertions(+), 12 deletions(-)
|
|
|
26d557 |
create mode 100644 test cases/frameworks/7 gnome/copyfile.py
|
|
|
26d557 |
delete mode 100644 test cases/frameworks/7 gnome/resources/copyfile.py
|
|
|
26d557 |
|
|
|
26d557 |
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
|
|
|
26d557 |
index 25cea6938..00feba45c 100644
|
|
|
26d557 |
--- a/mesonbuild/modules/gnome.py
|
|
|
26d557 |
+++ b/mesonbuild/modules/gnome.py
|
|
|
26d557 |
@@ -1556,11 +1556,11 @@ class GnomeModule(ExtensionModule):
|
|
|
26d557 |
def gtkdoc_html_dir(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'TYPE_kwargs') -> str:
|
|
|
26d557 |
return os.path.join('share/gtk-doc/html', args[0])
|
|
|
26d557 |
|
|
|
26d557 |
- @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File)])
|
|
|
26d557 |
+ @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)])
|
|
|
26d557 |
@typed_kwargs(
|
|
|
26d557 |
'gnome.gdbus_codegen',
|
|
|
26d557 |
_BUILD_BY_DEFAULT.evolve(since='0.40.0'),
|
|
|
26d557 |
- KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File)), since='0.46.0', default=[], listify=True),
|
|
|
26d557 |
+ KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)), since='0.46.0', default=[], listify=True),
|
|
|
26d557 |
KwargInfo('extra_args', ContainerTypeInfo(list, str), since='0.47.0', default=[], listify=True),
|
|
|
26d557 |
KwargInfo('interface_prefix', (str, NoneType)),
|
|
|
26d557 |
KwargInfo('namespace', (str, NoneType)),
|
|
|
26d557 |
@@ -1578,10 +1578,10 @@ class GnomeModule(ExtensionModule):
|
|
|
26d557 |
validator=in_set_validator({'all', 'none', 'objects'})),
|
|
|
26d557 |
INSTALL_DIR_KW.evolve(since='0.46.0')
|
|
|
26d557 |
)
|
|
|
26d557 |
- def gdbus_codegen(self, state: 'ModuleState', args: T.Tuple[str, T.Optional['FileOrString']],
|
|
|
26d557 |
+ def gdbus_codegen(self, state: 'ModuleState', args: T.Tuple[str, T.Optional[T.Union['FileOrString', 'build.GeneratedTypes']]],
|
|
|
26d557 |
kwargs: 'GdbusCodegen') -> ModuleReturnValue:
|
|
|
26d557 |
namebase = args[0]
|
|
|
26d557 |
- xml_files: T.List['FileOrString'] = [args[1]] if args[1] else []
|
|
|
26d557 |
+ xml_files: T.List[T.Union['FileOrString', 'build.GeneratedTypes']] = [args[1]] if args[1] else []
|
|
|
26d557 |
cmd: T.List[T.Union['ExternalProgram', str]] = [state.find_program('gdbus-codegen')]
|
|
|
26d557 |
cmd.extend(kwargs['extra_args'])
|
|
|
26d557 |
|
|
|
26d557 |
diff --git a/test cases/frameworks/7 gnome/copyfile.py b/test cases/frameworks/7 gnome/copyfile.py
|
|
|
26d557 |
new file mode 100644
|
|
|
26d557 |
index 000000000..7e44c48dd
|
|
|
26d557 |
--- /dev/null
|
|
|
26d557 |
+++ b/test cases/frameworks/7 gnome/copyfile.py
|
|
|
26d557 |
@@ -0,0 +1,6 @@
|
|
|
26d557 |
+#!/usr/bin/env python3
|
|
|
26d557 |
+
|
|
|
26d557 |
+import sys
|
|
|
26d557 |
+import shutil
|
|
|
26d557 |
+
|
|
|
26d557 |
+shutil.copy(sys.argv[1], sys.argv[2])
|
|
|
26d557 |
diff --git a/test cases/frameworks/7 gnome/gdbus/meson.build b/test cases/frameworks/7 gnome/gdbus/meson.build
|
|
|
26d557 |
index 682abfffe..d749033e9 100644
|
|
|
26d557 |
--- a/test cases/frameworks/7 gnome/gdbus/meson.build
|
|
|
26d557 |
+++ b/test cases/frameworks/7 gnome/gdbus/meson.build
|
|
|
26d557 |
@@ -58,6 +58,27 @@ else
|
|
|
26d557 |
includes = include_directories('..')
|
|
|
26d557 |
endif
|
|
|
26d557 |
|
|
|
26d557 |
+# check that custom targets work
|
|
|
26d557 |
+gdbus_xml_ct = custom_target('built xml sources for gdbus',
|
|
|
26d557 |
+ output: 'com.example.SampleCustomTarget.xml',
|
|
|
26d557 |
+ input: 'data/com.example.Sample.xml',
|
|
|
26d557 |
+ command : [copyfile, '@INPUT@', '@OUTPUT@'])
|
|
|
26d557 |
+
|
|
|
26d557 |
+gdbus_src_ct = gnome.gdbus_codegen(
|
|
|
26d557 |
+ 'generated-gdbus-customtarget-src',
|
|
|
26d557 |
+ gdbus_xml_ct,
|
|
|
26d557 |
+ interface_prefix : 'com.example.',
|
|
|
26d557 |
+ namespace : 'Sample',
|
|
|
26d557 |
+ annotations : [],
|
|
|
26d557 |
+)
|
|
|
26d557 |
+gdbus_src_cti = gnome.gdbus_codegen(
|
|
|
26d557 |
+ 'generated-gdbus-customtargetindex-src',
|
|
|
26d557 |
+ gdbus_xml_ct[0],
|
|
|
26d557 |
+ interface_prefix : 'com.example.',
|
|
|
26d557 |
+ namespace : 'Sample',
|
|
|
26d557 |
+ annotations : [],
|
|
|
26d557 |
+)
|
|
|
26d557 |
+
|
|
|
26d557 |
gdbus_exe = executable('gdbus-test', 'gdbusprog.c',
|
|
|
26d557 |
gdbus_src,
|
|
|
26d557 |
include_directories : includes,
|
|
|
26d557 |
diff --git a/test cases/frameworks/7 gnome/meson.build b/test cases/frameworks/7 gnome/meson.build
|
|
|
26d557 |
index 9f8640609..920bc6a82 100644
|
|
|
26d557 |
--- a/test cases/frameworks/7 gnome/meson.build
|
|
|
26d557 |
+++ b/test cases/frameworks/7 gnome/meson.build
|
|
|
26d557 |
@@ -1,5 +1,7 @@
|
|
|
26d557 |
project('gobject-introspection', 'c')
|
|
|
26d557 |
|
|
|
26d557 |
+copyfile = find_program('copyfile.py')
|
|
|
26d557 |
+
|
|
|
26d557 |
glib = dependency('glib-2.0', required: false)
|
|
|
26d557 |
if not glib.found()
|
|
|
26d557 |
error('MESON_SKIP_TEST glib not found.')
|
|
|
26d557 |
diff --git a/test cases/frameworks/7 gnome/resources/copyfile.py b/test cases/frameworks/7 gnome/resources/copyfile.py
|
|
|
26d557 |
deleted file mode 100644
|
|
|
26d557 |
index 7e44c48dd..000000000
|
|
|
26d557 |
--- a/test cases/frameworks/7 gnome/resources/copyfile.py
|
|
|
26d557 |
+++ /dev/null
|
|
|
26d557 |
@@ -1,6 +0,0 @@
|
|
|
26d557 |
-#!/usr/bin/env python3
|
|
|
26d557 |
-
|
|
|
26d557 |
-import sys
|
|
|
26d557 |
-import shutil
|
|
|
26d557 |
-
|
|
|
26d557 |
-shutil.copy(sys.argv[1], sys.argv[2])
|
|
|
26d557 |
diff --git a/test cases/frameworks/7 gnome/resources/meson.build b/test cases/frameworks/7 gnome/resources/meson.build
|
|
|
26d557 |
index 180b33851..60fc8481e 100644
|
|
|
26d557 |
--- a/test cases/frameworks/7 gnome/resources/meson.build
|
|
|
26d557 |
+++ b/test cases/frameworks/7 gnome/resources/meson.build
|
|
|
26d557 |
@@ -1,8 +1,6 @@
|
|
|
26d557 |
# There are two tests here, because the 2nd one depends on a version of
|
|
|
26d557 |
# GLib (2.51.1) that is very recent at the time of writing.
|
|
|
26d557 |
|
|
|
26d557 |
-copyfile = find_program('copyfile.py')
|
|
|
26d557 |
-
|
|
|
26d557 |
simple_gresource = configure_file(
|
|
|
26d557 |
input : 'simple.gresource.xml',
|
|
|
26d557 |
output : 'simple-gen.gresource.xml',
|
|
|
26d557 |
--
|
|
|
26d557 |
2.38.1
|
|
|
26d557 |
|