Apply parent vars to recursedeps.
This fixes an issue where cumulative conditions would fail to evaluate
if the recursed DEP (or custom_var overrides) didn't happen to redeclare
all the variables used by the parent conditions.
TBR=dpranke@google.com, ehmaldonado@google.com
Bug: 825063
Change-Id: Icb53f04928f914dfacc2c3035d01be103d9f8247
Reviewed-on: https://chromium-review.googlesource.com/1000836
Commit-Queue: Michael Moss <mmoss@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>
diff --git a/gclient.py b/gclient.py
index e8e496e..437190a 100755
--- a/gclient.py
+++ b/gclient.py
@@ -766,14 +766,10 @@
local_scope = {}
if deps_content:
try:
- vars_override = {}
- if self.parent:
- vars_override = self.parent.get_vars()
- vars_override.update(self.get_vars())
local_scope = gclient_eval.Parse(
deps_content, expand_vars,
self._get_option('validate_syntax', False),
- filepath, vars_override)
+ filepath, self.get_vars())
except SyntaxError as e:
gclient_utils.SyntaxErrorToError(filepath, e)
@@ -1369,8 +1365,15 @@
'checkout_x64': 'x64' in self.target_cpu,
'host_cpu': detect_host_arch.HostArch(),
}
- # Variables defined in DEPS file override built-in ones.
+ # Variable precedence:
+ # - built-in
+ # - DEPS vars
+ # - parents, from first to last
+ # - custom_vars overrides
result.update(self._vars)
+ if self.parent:
+ parent_vars = self.parent.get_vars()
+ result.update(parent_vars)
result.update(self.custom_vars or {})
return result