diff options
Diffstat (limited to 'src/buildstream/_stream.py')
-rw-r--r-- | src/buildstream/_stream.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index fc5b15211..a5391562a 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -31,6 +31,7 @@ from collections import deque from typing import List, Tuple from ._artifactelement import verify_artifact_ref, ArtifactElement +from ._artifactproject import ArtifactProject from ._exceptions import StreamError, ImplError, BstError, ArtifactElementError, ArtifactError from ._message import Message, MessageType from ._scheduler import ( @@ -1098,12 +1099,22 @@ class Stream: # def _load_artifacts(self, artifact_names): with self._context.messenger.simple_task("Loading artifacts") as task: - artifacts = [] + + # Use a set here to avoid duplicates. + # + # ArtifactElement.new_from_artifact_name() will take care of ensuring + # uniqueness of multiple artifact names which refer to the same artifact + # (e.g., if both weak and strong names happen to be requested), here we + # still need to ensure we generate a list that does not contain duplicates. + # + artifacts = set() for artifact_name in artifact_names: - artifacts.append(ArtifactElement._new_from_artifact_name(artifact_name, self._context, task)) + artifact = ArtifactElement.new_from_artifact_name(artifact_name, self._context, task) + artifacts.add(artifact) - ArtifactElement._clear_artifact_refs_cache() - return artifacts + ArtifactElement.clear_artifact_name_cache() + ArtifactProject.clear_project_cache() + return list(artifacts) # _load_elements_from_targets # |