rewriter: fix warning about empty sources

pull/11528/head
Charles Brunet 2 years ago committed by Jussi Pakkanen
parent 535498d367
commit 90b6d6dafb
  1. 1
      mesonbuild/ast/introspection.py
  2. 5
      mesonbuild/build.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()

@ -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()

Loading…
Cancel
Save