Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-duplicate BuildTarget.sourses #13868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
7 changes: 4 additions & 3 deletions mesonbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,8 @@ def __init__(
self.pch: T.Dict[str, T.List[str]] = {}
self.extra_args: T.DefaultDict[str, T.List[str]] = kwargs.get('language_args', defaultdict(list))
self.sources: T.List[File] = []
# If the same source is defined multiple times, use it only once.
self.seen_sources: T.Set[File] = set()
self.generated: T.List['GeneratedTypes'] = []
self.extra_files: T.List[File] = []
self.d_features: DFeatures = {
Expand Down Expand Up @@ -880,12 +882,11 @@ def process_sourcelist(self, sources: T.List['SourceOutputs']) -> None:
(static as they are only regenerated if meson itself is regenerated)
3. Sources files generated by another target or a Generator (generated)
"""
added_sources: T.Set[File] = set() # If the same source is defined multiple times, use it only once.
for s in sources:
if isinstance(s, File):
if s not in added_sources:
if s not in self.seen_sources:
self.sources.append(s)
added_sources.add(s)
self.seen_sources.add(s)
elif isinstance(s, (CustomTarget, CustomTargetIndex, GeneratedList)):
self.generated.append(s)

Expand Down
Loading