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