Skip to content

Commit e7bb256

Browse files
build: Add de-duplication for non-result targets in get_all_link_deps
1 parent 02bbe3e commit e7bb256

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mesonbuild/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,20 +1174,23 @@ 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: T.Set[BuildTargetTypes] = set()
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+
stack.extendleft((t2 for t2 in t.link_targets if t2 not in nonresults))
1193+
stack.extendleft((t2 for t2 in t.link_whole_targets if t2 not in nonresults))
11911194
return list(result)
11921195

11931196
@lru_cache(maxsize=None)

0 commit comments

Comments
 (0)