Skip to content

Commit

Permalink
test with only whole targets
Browse files Browse the repository at this point in the history
  • Loading branch information
eerii committed Sep 23, 2024
1 parent af3f754 commit 33f1c80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
17 changes: 6 additions & 11 deletions mesonbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,18 +1077,13 @@ def extract_objects(self, srclist: T.List[T.Union['FileOrString', 'GeneratedType
return ExtractedObjects(self, obj_src, obj_gen)

def extract_all_objects(self, recursive: bool = True) -> ExtractedObjects:
objects = self.objects.copy()
sources = self.sources.copy()
generated = self.generated.copy()
objects = self.objects
if recursive:
for target in self.link_targets:
if isinstance(target, StaticLibrary):
target_obj = target.extract_all_objects(recursive=recursive)
objects.append(target_obj)
objects = objects.copy()
for target in self.link_whole_targets:
target_obj = target.extract_all_objects(recursive=recursive)
objects.append(target_obj)
return ExtractedObjects(self, sources, generated, objects,
return ExtractedObjects(self, self.sources, self.generated, objects,
recursive, pch=True)

def get_all_link_deps(self) -> ImmutableListProtocol[BuildTargetTypes]:
Expand Down Expand Up @@ -2775,7 +2770,7 @@ def is_internal(self) -> bool:
return False
return CustomTargetIndex(self, self.outputs[0]).is_internal()

def extract_all_objects(self, _recursive: bool = False) -> T.List[T.Union[str, 'ExtractedObjects']]:
def extract_all_objects(self) -> T.List[T.Union[str, 'ExtractedObjects']]:
return self.get_outputs()

def type_suffix(self):
Expand Down Expand Up @@ -3054,8 +3049,8 @@ def is_internal(self) -> bool:
suf = os.path.splitext(self.output)[-1]
return suf in {'.a', '.lib'} and not self.should_install()

def extract_all_objects(self, recursive: bool = False) -> T.List[T.Union[str, 'ExtractedObjects']]:
return self.target.extract_all_objects(recursive)
def extract_all_objects(self) -> T.List[T.Union[str, 'ExtractedObjects']]:
return self.target.extract_all_objects()

def get_custom_install_dir(self) -> T.List[T.Union[str, Literal[False]]]:
return self.target.get_custom_install_dir()
Expand Down
4 changes: 2 additions & 2 deletions unittests/linuxliketests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1800,9 +1800,9 @@ def test_complex_link_cases(self):
with open(os.path.join(self.builddir, 'build.ninja'), encoding='utf-8') as f:
content = f.read()
# Verify link dependencies, see comments in meson.build.
self.assertIn('build libt1-s3.a: STATIC_LINKER libt1-s2.a.p/s2.c.o libt1-s3.a.p/s3.c.o\n', content)
self.assertIn('build libt1-s3.a: STATIC_LINKER libt1-s1.a.p/s1.c.o libt1-s2.a.p/s2.c.o libt1-s3.a.p/s3.c.o\n', content)
self.assertIn('build t1-e1: c_LINKER t1-e1.p/main.c.o | libt1-s1.a libt1-s3.a\n', content)
self.assertIn('build libt2-s3.a: STATIC_LINKER libt2-s2.a.p/s2.c.o libt2-s1.a.p/s1.c.o libt2-s3.a.p/s3.c.o\n', content)
self.assertIn('build libt2-s3.a: STATIC_LINKER libt2-s1.a.p/s1.c.o libt2-s2.a.p/s2.c.o libt2-s3.a.p/s3.c.o\n', content)
self.assertIn('build t2-e1: c_LINKER t2-e1.p/main.c.o | libt2-s3.a\n', content)
self.assertIn('build t3-e1: c_LINKER t3-e1.p/main.c.o | libt3-s3.so.p/libt3-s3.so.symbols\n', content)
self.assertIn('build t4-e1: c_LINKER t4-e1.p/main.c.o | libt4-s2.so.p/libt4-s2.so.symbols libt4-s3.a\n', content)
Expand Down

0 comments on commit 33f1c80

Please sign in to comment.