Skip to content

Commit b70f9f5

Browse files
build: Add de-duplication for non-result targets in get_all_link_deps
1 parent 658e791 commit b70f9f5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mesonbuild/build.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,20 +1174,27 @@ def get_all_link_deps(self) -> ImmutableListProtocol[BuildTargetTypes]:
11741174
at link time, see get_dependencies() for that.
11751175
"""
11761176
result: OrderedSet[BuildTargetTypes] = OrderedSet()
1177+
nonresults: OrderedSet[BuildTargetTypes] = OrderedSet()
11771178
stack: T.Deque[BuildTargetTypes] = deque()
11781179
stack.appendleft(self)
11791180
while stack:
11801181
t = stack.pop()
1181-
if t in result:
1182+
if t in result or t in nonresults:
11821183
continue
11831184
if isinstance(t, CustomTargetIndex):
11841185
stack.appendleft(t.target)
11851186
continue
11861187
if isinstance(t, SharedLibrary):
11871188
result.add(t)
1189+
else:
1190+
nonresults.add(t)
11881191
if isinstance(t, BuildTarget):
1189-
stack.extendleft(t.link_targets)
1190-
stack.extendleft(t.link_whole_targets)
1192+
for t2 in t.link_targets:
1193+
if t2 not in nonresults:
1194+
stack.appendleft(t2)
1195+
for t2 in t.link_whole_targets:
1196+
if t2 not in nonresults:
1197+
stack.appendleft(t2)
11911198
return list(result)
11921199

11931200
@lru_cache(maxsize=None)

0 commit comments

Comments
 (0)