diff options
Diffstat (limited to 'src/buildstream/_loader/loadcontext.py')
-rw-r--r-- | src/buildstream/_loader/loadcontext.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/buildstream/_loader/loadcontext.py b/src/buildstream/_loader/loadcontext.py index 6183a192b..4e6c9bca6 100644 --- a/src/buildstream/_loader/loadcontext.py +++ b/src/buildstream/_loader/loadcontext.py @@ -19,6 +19,7 @@ from .._exceptions import LoadError from ..exceptions import LoadErrorReason +from ..types import _ProjectInformation # ProjectLoaders() @@ -74,6 +75,21 @@ class ProjectLoaders: elif primary and duplicates: self._raise_conflict(duplicates, internal) + # loaded_projects() + # + # A generator which yeilds all of the instances + # of this loaded project. + # + # Yields: + # (_ProjectInformation): A descriptive project information object + # + def loaded_projects(self): + for loader in self._collect: + duplicating, internalizing = self._search_project_relationships(loader) + yield _ProjectInformation( + loader.project, loader.provenance, [str(l) for l in duplicating], [str(l) for l in internalizing] + ) + # _search_project_relationships() # # Searches this loader's ancestry for projects which mark this @@ -241,3 +257,14 @@ class LoadContext: self._loaders[project.name] = project_loaders project_loaders.register_loader(loader) + + # loaded_projects() + # + # A generator which yeilds all of the loaded projects + # + # Yields: + # (_ProjectInformation): A descriptive project information object + # + def loaded_projects(self): + for _, project_loaders in self._loaders.items(): + yield from project_loaders.loaded_projects() |