aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2023-02-23 16:05:44 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2023-03-14 16:22:05 +0200
commit90b6d6dafbbd22c90fa5e58b1de2bb74e7e5a4cf (patch)
tree045c9a9728387c3cc490b0a396006c771e3670e7
parent535498d3678aed5b5ec5f2cf5c2b63bc977e50eb (diff)
downloadmeson-90b6d6dafbbd22c90fa5e58b1de2bb74e7e5a4cf.zip
meson-90b6d6dafbbd22c90fa5e58b1de2bb74e7e5a4cf.tar.gz
meson-90b6d6dafbbd22c90fa5e58b1de2bb74e7e5a4cf.tar.bz2
rewriter: fix warning about empty sources
-rw-r--r--mesonbuild/ast/introspection.py1
-rw-r--r--mesonbuild/build.py5
2 files changed, 4 insertions, 2 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index 194c15b..98f03fd 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -278,6 +278,7 @@ class IntrospectionInterpreter(AstInterpreter):
objects = [] # type: T.List[T.Any]
empty_sources = [] # type: T.List[T.Any]
# Passing the unresolved sources list causes errors
+ kwargs_reduced['_allow_no_sources'] = True
target = targetclass(name, self.subdir, self.subproject, for_machine, empty_sources, [], objects,
self.environment, self.coredata.compilers[for_machine], kwargs_reduced)
target.process_compilers()
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index c017425..27c17da 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -743,11 +743,12 @@ class BuildTarget(Target):
# 2. Compiled objects created by and extracted from another target
self.process_objectlist(objects)
self.process_kwargs(kwargs)
- self.check_unknown_kwargs(kwargs)
- if not any([self.sources, self.generated, self.objects, self.link_whole_targets, self.structured_sources]):
+ if not any([self.sources, self.generated, self.objects, self.link_whole_targets, self.structured_sources,
+ kwargs.pop('_allow_no_sources', False)]):
mlog.warning(f'Build target {name} has no sources. '
'This was never supposed to be allowed but did because of a bug, '
'support will be removed in a future release of Meson')
+ self.check_unknown_kwargs(kwargs)
self.validate_install()
self.check_module_linking()