You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/07/25 09:00:34 UTC
[buildstream] 01/02: _project.py: Allow usage of first stage load options and variables
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/fix-load-cross-project-element
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 56c7723c22c44cc76af27fc9490280baeef83137
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Jul 25 16:13:29 2022 +0900
_project.py: Allow usage of first stage load options and variables
For options, it is clear that the first stage load is sufficient in every
case, it is illegal for options to be resolved differently in the second
pass.
For variables, we allow usage of the first stage, while the second stage
might be more complete, in some scenarios we need to access the variables
from the first stage.
---
src/buildstream/_project.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index 1ac8fe8b1..683907bd8 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -181,11 +181,20 @@ class Project:
@property
def options(self):
- return self.config.options
+ #
+ # We sometimes need the resolved options from the first pass,
+ # but the options from the second pass can never differ from
+ # the options in the first pass.
+ #
+ return self.first_pass_config.options
@property
def base_variables(self):
- return self.config.base_variables
+ if isinstance(self.config.base_variables, MappingNode):
+ return self.config.base_variables
+
+ assert isinstance(self.first_pass_config.base_variables, MappingNode)
+ return self.first_pass_config.base_variables
@property
def element_overrides(self):