Add git_dependencies flag to DEPS
This change adds `git_dependencies` flag to the DEPS. This will be used to track the submodule migration state.
Design Doc: go/depot-tools-on-submodules
Change-Id: I547ad8ebbce2535960d4b6e00c0b14c00118f544
Bug: 1429149
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4591777
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/gclient_eval.py b/gclient_eval.py
index 5571946..ac4f49b 100644
--- a/gclient_eval.py
+++ b/gclient_eval.py
@@ -24,6 +24,13 @@
basestring = str
+# git_dependencies migration states. Used within the DEPS file to indicate
+# the current migration state.
+DEPS = 'DEPS'
+SYNC = 'SYNC'
+SUBMODULES = 'SUBMODULES'
+
+
class ConstantString(object):
def __init__(self, value):
self.value = value
@@ -156,6 +163,11 @@
_GCLIENT_SCHEMA = schema.Schema(
_NodeDictSchema({
+ # Current state of the git submodule migration.
+ # git_dependencies = [DEPS (default) | SUBMODULES | SYNC]
+ schema.Optional('git_dependencies'):
+ schema.Or(DEPS, SYNC, SUBMODULES),
+
# List of host names from which dependencies are allowed (allowlist).
# NOTE: when not present, all hosts are allowed.
# NOTE: scoped to current DEPS file, not recursive.
@@ -169,21 +181,25 @@
#
# Var(): allows variable substitution (either from 'vars' dict below,
# or command-line override)
- schema.Optional('deps'): _GCLIENT_DEPS_SCHEMA,
+ schema.Optional('deps'):
+ _GCLIENT_DEPS_SCHEMA,
# Similar to 'deps' (see above) - also keyed by OS (e.g. 'linux').
# Also see 'target_os'.
- schema.Optional('deps_os'): _NodeDictSchema({
+ schema.Optional('deps_os'):
+ _NodeDictSchema({
schema.Optional(basestring): _GCLIENT_DEPS_SCHEMA,
}),
# Dependency to get gclient_gn_args* settings from. This allows these
# values to be set in a recursedeps file, rather than requiring that
# they exist in the top-level solution.
- schema.Optional('gclient_gn_args_from'): basestring,
+ schema.Optional('gclient_gn_args_from'):
+ basestring,
# Path to GN args file to write selected variables.
- schema.Optional('gclient_gn_args_file'): basestring,
+ schema.Optional('gclient_gn_args_file'):
+ basestring,
# Subset of variables to write to the GN args file (see above).
schema.Optional('gclient_gn_args'): [schema.Optional(basestring)],
@@ -191,12 +207,12 @@
# Hooks executed after gclient sync (unless suppressed), or explicitly
# on gclient hooks. See _GCLIENT_HOOKS_SCHEMA for details.
# Also see 'pre_deps_hooks'.
- schema.Optional('hooks'): _GCLIENT_HOOKS_SCHEMA,
+ schema.Optional('hooks'):
+ _GCLIENT_HOOKS_SCHEMA,
# Similar to 'hooks', also keyed by OS.
- schema.Optional('hooks_os'): _NodeDictSchema({
- schema.Optional(basestring): _GCLIENT_HOOKS_SCHEMA
- }),
+ schema.Optional('hooks_os'):
+ _NodeDictSchema({schema.Optional(basestring): _GCLIENT_HOOKS_SCHEMA}),
# Rules which #includes are allowed in the directory.
# Also see 'skip_child_includes' and 'specific_include_rules'.
@@ -208,21 +224,22 @@
# will not inherit rules from //base/DEPS and //base/allocator/DEPS,
# forcing each //base/allocator/partition_allocator/{foo,bar,...} to
# declare all its dependencies.
- schema.Optional('noparent'): bool,
+ schema.Optional('noparent'):
+ bool,
# Hooks executed before processing DEPS. See 'hooks' for more details.
- schema.Optional('pre_deps_hooks'): _GCLIENT_HOOKS_SCHEMA,
+ schema.Optional('pre_deps_hooks'):
+ _GCLIENT_HOOKS_SCHEMA,
# Recursion limit for nested DEPS.
- schema.Optional('recursion'): int,
+ schema.Optional('recursion'):
+ int,
# Allowlists deps for which recursion should be enabled.
schema.Optional('recursedeps'): [
- schema.Optional(schema.Or(
- basestring,
- (basestring, basestring),
- [basestring, basestring]
- )),
+ schema.Optional(
+ schema.Or(basestring, (basestring, basestring),
+ [basestring, basestring])),
],
# Blocklists directories for checking 'include_rules'.
@@ -230,9 +247,8 @@
# Mapping from paths to include rules specific for that path.
# See 'include_rules' for more details.
- schema.Optional('specific_include_rules'): _NodeDictSchema({
- schema.Optional(basestring): [basestring]
- }),
+ schema.Optional('specific_include_rules'):
+ _NodeDictSchema({schema.Optional(basestring): [basestring]}),
# List of additional OS names to consider when selecting dependencies
# from deps_os.
@@ -241,17 +257,19 @@
# For recursed-upon sub-dependencies, check out their own dependencies
# relative to the parent's path, rather than relative to the .gclient
# file.
- schema.Optional('use_relative_paths'): bool,
+ schema.Optional('use_relative_paths'):
+ bool,
# For recursed-upon sub-dependencies, run their hooks relative to the
# parent's path instead of relative to the .gclient file.
- schema.Optional('use_relative_hooks'): bool,
+ schema.Optional('use_relative_hooks'):
+ bool,
# Variables that can be referenced using Var() - see 'deps'.
- schema.Optional('vars'): _NodeDictSchema({
- schema.Optional(basestring): schema.Or(ConstantString,
- basestring,
- bool),
+ schema.Optional('vars'):
+ _NodeDictSchema({
+ schema.Optional(basestring):
+ schema.Or(ConstantString, basestring, bool),
}),
}))