Skip to content

Commit 4b016e2

Browse files
committed
Revert "build: Throw an error instead of warning for sourceless targets"
This reverts commit 651aede. This was most certainly not acceptable.
1 parent 8530b67 commit 4b016e2

File tree

7 files changed

+12
-10
lines changed

7 files changed

+12
-10
lines changed

mesonbuild/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,9 @@ def __init__(
760760

761761
if not any([[src for src in self.sources if not is_header(src)], self.generated, self.objects,
762762
self.link_whole_targets, self.structured_sources, kwargs.pop('_allow_no_sources', False)]):
763-
raise MesonException(f'Build target {name} has no sources.')
763+
mlog.warning(f'Build target {name} has no sources. '
764+
'This was never supposed to be allowed but did because of a bug, '
765+
'support will be removed in a future release of Meson')
764766
self.check_unknown_kwargs(kwargs)
765767
self.validate_install()
766768
self.check_module_linking()

test cases/common/44 pkgconfig-gen/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ endtestcase
189189
# Make sure the -uninstalled.pc file contains both include directories.
190190
# See dependencies/test2.c that gets built against both simple7.pc and
191191
# simple7-uninstalled.pc.
192-
simple7 = library('simple7', 'simple7.c', include_directories: 'inc1')
192+
simple7 = library('simple7', include_directories: 'inc1')
193193
dep = declare_dependency(include_directories: 'inc2')
194194
install_headers('inc1/inc1.h', 'inc2/inc2.h')
195195
pkgg.generate(simple7, libraries: dep)

test cases/common/44 pkgconfig-gen/simple7.c

Whitespace-only changes.

test cases/failing/136 target with no sources/test.json

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"stdout": [
3+
{
4+
"line": "WARNING: Build target no sources 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"
5+
}
6+
]
7+
}

unittests/allplatformstests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4819,7 +4819,7 @@ def output_name(name, type_):
48194819
for_machine=MachineChoice.HOST, sources=[],
48204820
structured_sources=None,
48214821
objects=[], environment=env, compilers=env.coredata.compilers[MachineChoice.HOST],
4822-
kwargs={'_allow_no_sources': True})
4822+
kwargs={})
48234823
target.process_compilers_late()
48244824
return target.filename
48254825

0 commit comments

Comments
 (0)