gclient: make variables from parent DEPS scope override ones in inner scope

This is part of preparation for gclient flatten, conditions,
and improving internal gclient workflows.

This also ensures variables have consistent values in the entire checkout,
unlike the current situation where different DEPS files can use different
values for the same variable.

We override instead of erroring out, since otherwise commonly used dependencies
such as buildtools wuld have to be rolled simultaneously in unrelated projects,
say v8 and native_client.

Another reason for overriding are possible future use cases such as is_chromium_build,
which could be set to false e.g. in v8, but chromium DEPS would override it to true.

Bug: 570091
Change-Id: If61322dd9a55e57729a4100d05ecb9c1e3ae8e38
Reviewed-on: https://chromium-review.googlesource.com/596310
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
changes/10/596310/2
Paweł Hajdan, Jr 8 years ago committed by Commit Bot
parent 07a6bea90f
commit 1407d00d0b

@ -707,9 +707,14 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self._gn_args_file = local_scope.get('gclient_gn_args_file')
self._gn_args = local_scope.get('gclient_gn_args', [])
self._vars = local_scope.get('vars', {})
if self.parent:
for key, value in self.parent.get_vars().iteritems():
if key in self._vars:
self._vars[key] = value
# Since we heavily post-process things, freeze ones which should
# reflect original state of DEPS.
self._vars = gclient_utils.freeze(local_scope.get('vars', {}))
self._vars = gclient_utils.freeze(self._vars)
# If use_relative_paths is set in the DEPS file, regenerate
# the dictionary using paths relative to the directory containing

Loading…
Cancel
Save