Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions mesonbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,20 +1174,23 @@ def get_all_link_deps(self) -> ImmutableListProtocol[BuildTargetTypes]:
at link time, see get_dependencies() for that.
"""
result: OrderedSet[BuildTargetTypes] = OrderedSet()
nonresults: T.Set[BuildTargetTypes] = set()
stack: T.Deque[BuildTargetTypes] = deque()
stack.appendleft(self)
while stack:
t = stack.pop()
if t in result:
if t in result or t in nonresults:
continue
if isinstance(t, CustomTargetIndex):
stack.appendleft(t.target)
continue
if isinstance(t, SharedLibrary):
result.add(t)
else:
nonresults.add(t)
if isinstance(t, BuildTarget):
stack.extendleft(t.link_targets)
stack.extendleft(t.link_whole_targets)
stack.extendleft((t2 for t2 in t.link_targets if t2 not in nonresults))
stack.extendleft((t2 for t2 in t.link_whole_targets if t2 not in nonresults))
return list(result)

@lru_cache(maxsize=None)
Expand Down
Loading