Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Unified Diff: recipe_modules/infra_paths/config.py

Issue 1915463002: depot_tools: add infra_paths recipe module for infra-specific paths (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: recipe_modules/infra_paths/config.py
diff --git a/recipe_modules/infra_paths/config.py b/recipe_modules/infra_paths/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..ac2643053c1f6d79046596d69fa38a894bc7e65a
--- /dev/null
+++ b/recipe_modules/infra_paths/config.py
@@ -0,0 +1,57 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from recipe_engine.config import config_item_context, ConfigGroup, Dict, Static
+from recipe_engine.config_types import Path
+
+def BaseConfig(PLATFORM, CURRENT_WORKING_DIR, ROOT, **_kwargs):
+ #assert CURRENT_WORKING_DIR[0].endswith(('\\', '/'))
+ return ConfigGroup(
+ paths = Dict(value_type=Path),
+
+ PLATFORM = Static(PLATFORM),
+ CURRENT_WORKING_DIR = Static(CURRENT_WORKING_DIR),
+ ROOT = Static(ROOT),
+ )
+
+config_ctx = config_item_context(BaseConfig)
+
+@config_ctx(is_root=True)
+def BASE(c):
+ #c.paths['cwd'] = c.CURRENT_WORKING_DIR
+ #c.paths['tmp_base'] = c.TEMP_DIR
+ pass
+
+@config_ctx()
+def buildbot(c):
+ c.paths['root'] = c.ROOT.join('b')
+ c.paths['slave_build'] = c.CURRENT_WORKING_DIR
+ c.paths['cache'] = c.paths['root'].join(
+ 'build', 'slave', 'cache')
+ c.paths['git_cache'] = c.paths['root'].join(
+ 'build', 'slave', 'cache_dir')
+ c.paths['goma_cache'] = c.paths['root'].join(
+ 'build', 'slave', 'goma_cache')
+ for token in ('build_internal', 'build', 'depot_tools'):
+ c.paths[token] = c.paths['root'].join(token,)
+
+@config_ctx()
+def kitchen(c):
+ c.paths['root'] = c.CURRENT_WORKING_DIR
+ c.paths['slave_build'] = c.CURRENT_WORKING_DIR
+ # TODO(phajdan.jr): have one cache dir, let clients append suffixes.
+ # TODO(phajdan.jr): set persistent cache path for remaining platforms.
+ # NOTE: do not use /b/swarm_slave here - it gets deleted on bot redeploy,
+ # and may happen even after a reboot.
+ if c.PLATFORM == 'linux':
+ c.paths['cache'] = c.ROOT.join(
+ 'b', 'cache', 'chromium')
+ c.paths['git_cache'] = c.ROOT.join(
+ 'b', 'cache', 'chromium', 'git_cache')
+ c.paths['goma_cache'] = c.ROOT.join(
+ 'b', 'cache', 'chromium', 'goma_cache')
+ else:
+ c.paths['cache'] = c.paths['root'].join('cache')
+ c.paths['git_cache'] = c.paths['root'].join('cache_dir')
+ c.paths['goma_cache'] = c.paths['root'].join('goma_cache')

Powered by Google App Engine
This is Rietveld 408576698