OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 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 from recipe_engine.config import config_item_context, ConfigGroup, Dict, Static |
| 6 from recipe_engine.config_types import Path |
| 7 |
| 8 def BaseConfig(PLATFORM, CURRENT_WORKING_DIR, ROOT, **_kwargs): |
| 9 #assert CURRENT_WORKING_DIR[0].endswith(('\\', '/')) |
| 10 return ConfigGroup( |
| 11 paths = Dict(value_type=Path), |
| 12 |
| 13 PLATFORM = Static(PLATFORM), |
| 14 CURRENT_WORKING_DIR = Static(CURRENT_WORKING_DIR), |
| 15 ROOT = Static(ROOT), |
| 16 ) |
| 17 |
| 18 config_ctx = config_item_context(BaseConfig) |
| 19 |
| 20 @config_ctx(is_root=True) |
| 21 def BASE(c): |
| 22 #c.paths['cwd'] = c.CURRENT_WORKING_DIR |
| 23 #c.paths['tmp_base'] = c.TEMP_DIR |
| 24 pass |
| 25 |
| 26 @config_ctx() |
| 27 def buildbot(c): |
| 28 c.paths['root'] = c.ROOT.join('b') |
| 29 c.paths['slave_build'] = c.CURRENT_WORKING_DIR |
| 30 c.paths['cache'] = c.paths['root'].join( |
| 31 'build', 'slave', 'cache') |
| 32 c.paths['git_cache'] = c.paths['root'].join( |
| 33 'build', 'slave', 'cache_dir') |
| 34 c.paths['goma_cache'] = c.paths['root'].join( |
| 35 'build', 'slave', 'goma_cache') |
| 36 for token in ('build_internal', 'build', 'depot_tools'): |
| 37 c.paths[token] = c.paths['root'].join(token,) |
| 38 |
| 39 @config_ctx() |
| 40 def kitchen(c): |
| 41 c.paths['root'] = c.CURRENT_WORKING_DIR |
| 42 c.paths['slave_build'] = c.CURRENT_WORKING_DIR |
| 43 # TODO(phajdan.jr): have one cache dir, let clients append suffixes. |
| 44 # TODO(phajdan.jr): set persistent cache path for remaining platforms. |
| 45 # NOTE: do not use /b/swarm_slave here - it gets deleted on bot redeploy, |
| 46 # and may happen even after a reboot. |
| 47 if c.PLATFORM == 'linux': |
| 48 c.paths['cache'] = c.ROOT.join( |
| 49 'b', 'cache', 'chromium') |
| 50 c.paths['git_cache'] = c.ROOT.join( |
| 51 'b', 'cache', 'chromium', 'git_cache') |
| 52 c.paths['goma_cache'] = c.ROOT.join( |
| 53 'b', 'cache', 'chromium', 'goma_cache') |
| 54 else: |
| 55 c.paths['cache'] = c.paths['root'].join('cache') |
| 56 c.paths['git_cache'] = c.paths['root'].join('cache_dir') |
| 57 c.paths['goma_cache'] = c.paths['root'].join('goma_cache') |
OLD | NEW |