Skip to content

Commit

Permalink
Formatting and test
Browse files Browse the repository at this point in the history
  • Loading branch information
eerii committed Sep 23, 2024
1 parent af3f754 commit 037b963
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions mesonbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,18 +1077,17 @@ 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:
objects = objects.copy()
for target in self.link_targets:
if isinstance(target, StaticLibrary):
target_obj = target.extract_all_objects(recursive=recursive)
objects.append(target_obj)
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
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 037b963

Please sign in to comment.