OLD | NEW |
(Empty) | |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import types |
| 6 |
| 7 from recipe_engine.config import config_item_context, ConfigGroup, BadConf |
| 8 from recipe_engine.config import ConfigList, Dict, Single, Static, Set, List |
| 9 |
| 10 from . import api as gclient_api |
| 11 |
| 12 |
| 13 def BaseConfig(USE_MIRROR=True, GIT_MODE=False, CACHE_DIR=None, |
| 14 PATCH_PROJECT=None, BUILDSPEC_VERSION=None, |
| 15 **_kwargs): |
| 16 deps = '.DEPS.git' if GIT_MODE else 'DEPS' |
| 17 cache_dir = str(CACHE_DIR) if GIT_MODE and CACHE_DIR else None |
| 18 return ConfigGroup( |
| 19 solutions = ConfigList( |
| 20 lambda: ConfigGroup( |
| 21 name = Single(basestring), |
| 22 url = Single(basestring), |
| 23 deps_file = Single(basestring, empty_val=deps, required=False, |
| 24 hidden=False), |
| 25 managed = Single(bool, empty_val=True, required=False, hidden=False), |
| 26 custom_deps = Dict(value_type=(basestring, types.NoneType)), |
| 27 custom_vars = Dict(value_type=basestring), |
| 28 safesync_url = Single(basestring, required=False), |
| 29 |
| 30 revision = Single( |
| 31 (basestring, gclient_api.RevisionResolver), |
| 32 required=False, hidden=True), |
| 33 ) |
| 34 ), |
| 35 deps_os = Dict(value_type=basestring), |
| 36 hooks = List(basestring), |
| 37 target_os = Set(basestring), |
| 38 target_os_only = Single(bool, empty_val=False, required=False), |
| 39 cache_dir = Static(cache_dir, hidden=False), |
| 40 |
| 41 # If supplied, use this as the source root (instead of the first solution's |
| 42 # checkout). |
| 43 src_root = Single(basestring, required=False, hidden=True), |
| 44 |
| 45 # Maps 'solution' -> build_property |
| 46 got_revision_mapping = Dict(hidden=True), |
| 47 |
| 48 # Addition revisions we want to pass in. For now theres a duplication |
| 49 # of code here of setting custom vars AND passing in --revision. We hope |
| 50 # to remove custom vars later. |
| 51 revisions = Dict( |
| 52 value_type=(basestring, gclient_api.RevisionResolver), |
| 53 hidden=True), |
| 54 |
| 55 # TODO(iannucci): HACK! The use of None here to indicate that we apply this |
| 56 # to the solution.revision field is really terrible. I mostly blame |
| 57 # gclient. |
| 58 # Maps 'parent_build_property' -> 'custom_var_name' |
| 59 # Maps 'parent_build_property' -> None |
| 60 # If value is None, the property value will be applied to |
| 61 # solutions[0].revision. Otherwise, it will be applied to |
| 62 # solutions[0].custom_vars['custom_var_name'] |
| 63 parent_got_revision_mapping = Dict(hidden=True), |
| 64 delete_unversioned_trees = Single(bool, empty_val=True, required=False), |
| 65 |
| 66 # Check out refs/branch-heads. |
| 67 # TODO (machenbach): Only implemented for bot_update atm. |
| 68 with_branch_heads = Single( |
| 69 bool, |
| 70 empty_val=False, |
| 71 required=False, |
| 72 hidden=True), |
| 73 |
| 74 GIT_MODE = Static(bool(GIT_MODE)), |
| 75 USE_MIRROR = Static(bool(USE_MIRROR)), |
| 76 PATCH_PROJECT = Static(str(PATCH_PROJECT), hidden=True), |
| 77 BUILDSPEC_VERSION= Static(BUILDSPEC_VERSION, hidden=True), |
| 78 ) |
| 79 |
| 80 config_ctx = config_item_context(BaseConfig) |
OLD | NEW |