diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-17 22:50:42 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-17 22:55:29 +0900 |
commit | b1e4fcfc41d56ff82547541298ffa186ebd4bd32 (patch) | |
tree | bbd8ac4c4eab142acffbf0103519e32b745fff61 | |
parent | 97c8f0b314f2bef6dc6b111e4a91ed14d880b6fd (diff) | |
download | buildstream-b1e4fcfc41d56ff82547541298ffa186ebd4bd32.tar.gz |
_pipeline.py: Work with new project variants
This means:
o Load the project elements passing in the possible variants
exposed by the project, allowing the loader to error on
nonexisting variants and to choose a project variant.
o Resolve the project variant after loading the meta elements,
but before materializing the Element and Source objects
o Delay creation of the plugin contexts and factories until
after the project is resolved.
-rw-r--r-- | buildstream/_pipeline.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 02896eafa..d96b4945d 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -136,16 +136,22 @@ class Pipeline(): self.session_elements = 0 self.total_elements = 0 - pluginbase = PluginBase(package='buildstream.plugins') - self.element_factory = ElementFactory(pluginbase, project._plugin_element_paths) - self.source_factory = SourceFactory(pluginbase, project._plugin_source_paths) - loader = Loader(self.project.element_path, target, target_variant, - context.host_arch, context.target_arch) + context.host_arch, context.target_arch, + list(project._list_variants())) meta_element = loader.load(rewritable, load_ticker) if load_ticker: load_ticker(None) + # Resolve project variant now that we've decided on one + project._resolve(loader.project_variant) + + # Create the factories after resolving the project + pluginbase = PluginBase(package='buildstream.plugins') + self.element_factory = ElementFactory(pluginbase, project._plugin_element_paths) + self.source_factory = SourceFactory(pluginbase, project._plugin_source_paths) + + # Resolve the real elements now that we've resolved the project self.target = self.resolve(meta_element, ticker=resolve_ticker) if resolve_ticker: resolve_ticker(None) |