Add recursion=n syntax to DEPS files.
This will let DEPS files specify a higher local bound for recursion.
Note there is an edge case where a dependency can be initially pulled
in with a lower recursion level and then gets ignored subsequently
when a lower level DEPS overrides it's inclusion level and then
includes the same dependency. I do not solve this case, as
I am intending to use this syntax for top level deps files.
BUG=155780
Review URL: https://chromiumcodereview.appspot.com/11146032
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@162464 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient.py b/gclient.py
index 9065952..ab52cc8 100644
--- a/gclient.py
+++ b/gclient.py
@@ -168,6 +168,10 @@
# recursion limit and controls gclient's behavior so it does not misbehave.
self._managed = managed
self._should_process = should_process
+ # This is a mutable value that overrides the normal recursion limit for this
+ # dependency. It is read from the actual DEPS file so cannot be set on
+ # class instantiation.
+ self.recursion_override = None
# These are only set in .gclient and not in DEPS files.
self._custom_vars = custom_vars or {}
@@ -231,6 +235,8 @@
@property
def recursion_limit(self):
"""Returns > 0 if this dependency is not too recursed to be processed."""
+ if self.recursion_override is not None:
+ return self.recursion_override
return max(self.parent.recursion_limit - 1, 0)
def get_custom_deps(self, name, url):
@@ -445,6 +451,10 @@
except SyntaxError, e:
gclient_utils.SyntaxErrorToError(filepath, e)
deps = local_scope.get('deps', {})
+ if 'recursion' in local_scope:
+ self.recursion_override = local_scope.get('recursion')
+ logging.warning(
+ 'Setting %s recursion to %d.', self.name, self.recursion_limit)
# load os specific dependencies if defined. these dependencies may
# override or extend the values defined by the 'deps' member.
if 'deps_os' in local_scope: