summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-01-16 09:19:45 +0100
committerJürg Billeter <j@bitron.ch>2018-02-08 16:38:48 +0100
commitce1b5bf600461465d10a61835a2783dddc1ac59a (patch)
tree839542443f170e4b6a0395b345eb7f001c065e25
parent319af30c4426375c843d5c0113904657b5e48bf1 (diff)
downloadbuildstream-ce1b5bf600461465d10a61835a2783dddc1ac59a.tar.gz
Add list of projects to Context
-rw-r--r--buildstream/_context.py21
-rw-r--r--buildstream/_project.py2
2 files changed, 23 insertions, 0 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 9c91eebb2..9801f54c4 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -109,6 +109,7 @@ class Context():
self._message_handler = None
self._message_depth = deque()
self._platform = None
+ self._projects = []
self._project_overrides = {}
self._fetch_subprojects = fetch_subprojects
@@ -207,6 +208,26 @@ class Context():
"{}: on-error should be one of: {}".format(
provenance, ", ".join(valid_actions)))
+ # _add_project():
+ #
+ # Add a project to the context.
+ #
+ # Args:
+ # project (Project): The project to add
+ #
+ def _add_project(self, project):
+ self._projects.append(project)
+
+ # _get_projects():
+ #
+ # Return the list of projects in the context.
+ #
+ # Returns:
+ # (list): The list of projects
+ #
+ def _get_projects(self):
+ return self._projects
+
# _get_overrides():
#
# Fetch the override dictionary for the active project. This returns
diff --git a/buildstream/_project.py b/buildstream/_project.py
index 992dd6274..7a5c1f9de 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -82,6 +82,8 @@ class Project():
self._load()
profile_end(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-'))
+ self._context._add_project(self)
+
# translate_url():
#
# Translates the given url which may be specified with an alias