diff options
author | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-06-14 21:23:19 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2020-06-16 16:18:21 +0000 |
commit | deb6562719c2ca90b5fbdc2974e8a77da8430a96 (patch) | |
tree | 8930acee7295640e355c4a957b4919653663ea11 /src/buildstream/_pipeline.py | |
parent | 3774ce42263b947b211c6bb54aea85a00caa561e (diff) | |
download | buildstream-tristan/load-context.tar.gz |
_loader: Adding LoadContexttristan/load-context
Instead of passing around many details though calling signatures
throughout the loader code, create a single LoadContext object
which holds any overall loading state along with any values which
are constant to a full load process.
Overall this patch does:
* _frontend/app.py: No need to pass Stream.fetch_subprojects() along anymore
* _loader/loadelement.pyx: collect_element_no_deps() no longer takes a task argument
* _loader/loader.py: Now the Loader has a `load_context` member, and no more
`_fetch_subprojects` member or `_context` members
Further, `rewritable` and `ticker` is no longer passed along through all
of the recursing calling signatures, and `ticker` itself is finally removed
because this has been replaced a long time ago with `Task` API from `State`.
* _pipeline.py: The load() function no longer has a `rewritable` parameter
* _project.py: The Project() is responsible for creating the toplevel
LoadContext() if one doesn't exist yet, and this is passed through
to the Loader() (and also passed to the Project() constructor by the
Loader() when instantiating subprojects).
* _stream.py: The `Stream._fetch_subprojects()` is now private and set
on the project when giving the Project to the Stream in `Stream.set_project()`,
also the Stream() sets the `rewritable` state on the `LoadContext` at the
earliest opportunity, as the `Stream()` is the one who decides this detail.
Further, some double underscore private functions are now regular single
underscores, there was no reason for this inconsistency.
* tests/internals/loader.py: Updated for API change
Diffstat (limited to 'src/buildstream/_pipeline.py')
-rw-r--r-- | src/buildstream/_pipeline.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py index 8de97bea6..9edc6f51b 100644 --- a/src/buildstream/_pipeline.py +++ b/src/buildstream/_pipeline.py @@ -62,19 +62,17 @@ class Pipeline: # # Args: # target_groups (list of lists): Groups of toplevel targets to load - # rewritable (bool): Whether the loaded files should be rewritable - # this is a bit more expensive due to deep copies # # Returns: # (tuple of lists): A tuple of grouped Element objects corresponding to target_groups # - def load(self, target_groups, *, rewritable=False): + def load(self, target_groups): # First concatenate all the lists for the loader's sake targets = list(itertools.chain(*target_groups)) with PROFILER.profile(Topics.LOAD_PIPELINE, "_".join(t.replace(os.sep, "-") for t in targets)): - elements = self._project.load_elements(targets, rewritable=rewritable) + elements = self._project.load_elements(targets) # Now create element groups to match the input target groups elt_iter = iter(elements) |