diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 165889db8..d4d6bb14e 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -825,6 +825,7 @@ external dependencies (including libraries) must go to "dependencies".''') subi.modules = self.modules subi.holder_map = self.holder_map subi.bound_holder_map = self.bound_holder_map + subi.summary = self.summary subi.subproject_stack = self.subproject_stack + [subp_name] current_active = self.active_projectname @@ -854,7 +855,6 @@ external dependencies (including libraries) must go to "dependencies".''') self.build.merge(subi.build) self.build.subprojects[subp_name] = subi.project_version self.coredata.initialized_subprojects.add(subp_name) - self.summary.update(subi.summary) return self.subprojects[subp_name] def _do_subproject_cmake(self, subp_name, subdir, subdir_abs, default_options, kwargs): @@ -1177,8 +1177,9 @@ external dependencies (including libraries) must go to "dependencies".''') # Print all summaries, main project last. mlog.log('') # newline main_summary = self.summary.pop('', None) - for _, summary in sorted(self.summary.items()): - summary.dump() + for subp_name, summary in sorted(self.summary.items()): + if self.subprojects[subp_name].found(): + summary.dump() if main_summary: main_summary.dump() diff --git a/test cases/unit/72 summary/subprojects/sub2/meson.build b/test cases/unit/72 summary/subprojects/sub2/meson.build index 86b9cfd85..2560bd05d 100644 --- a/test cases/unit/72 summary/subprojects/sub2/meson.build +++ b/test cases/unit/72 summary/subprojects/sub2/meson.build @@ -1,5 +1,6 @@ project('sub2') -error('This subproject failed') +subproject('subsub') summary('Section', 'Should not be seen') +error('This subproject failed') diff --git a/test cases/unit/72 summary/subprojects/sub2/subprojects/subsub/meson.build b/test cases/unit/72 summary/subprojects/sub2/subprojects/subsub/meson.build new file mode 100644 index 000000000..98a5a269d --- /dev/null +++ b/test cases/unit/72 summary/subprojects/sub2/subprojects/subsub/meson.build @@ -0,0 +1,3 @@ +project('subsub') + +summary('Something', 'Some value') diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index b7881f641..6a405c1f6 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -3091,6 +3091,10 @@ class AllPlatformTests(BasePlatformTests): integer: 1 boolean: True + subsub undefined + + Something: Some value + My Project 1.0 Configuration @@ -3120,6 +3124,7 @@ class AllPlatformTests(BasePlatformTests): Subprojects sub : YES sub2 : NO Problem encountered: This subproject failed + subsub : YES ''') expected_lines = expected.split('\n')[1:] out_start = out.find(expected_lines[0])