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

Unified Diff: tools/cr/cr/actions/ninja.py

Issue 131543004: Make cr build run goma_ctl.py ensure_start before building. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/Execute/ExecuteSilently/ Created 6 years, 11 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
« no previous file with comments | « no previous file | tools/cr/cr/base/host.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cr/cr/actions/ninja.py
diff --git a/tools/cr/cr/actions/ninja.py b/tools/cr/cr/actions/ninja.py
index 404e6caea26e11360bf1b874e72c8de38f3fd697..651bca96df3a4fb780b3d04497c3af2d2cab25f4 100644
--- a/tools/cr/cr/actions/ninja.py
+++ b/tools/cr/cr/actions/ninja.py
@@ -20,7 +20,12 @@ class NinjaBuilder(cr.Builder):
NINJA_BINARY=os.path.join('{DEPOT_TOOLS}', 'ninja'),
NINJA_JOBS=200,
NINJA_PROCESSORS=12,
+ NINJA_BUILD_FILE=os.path.join('{CR_BUILD_DIR}', 'build.ninja'),
GOMA_DIR=os.path.join('{GOOGLE_CODE}', 'goma'),
+ # Don't rename to GOMA_* or Goma will complain: "unkown GOMA_ parameter".
+ NINJA_GOMA_CTL=os.path.join('{GOMA_DIR}', 'goma_ctl.py'),
+ NINJA_GOMA_CC=os.path.join('{GOMA_DIR}', 'gomacc'),
+ NINJA_GOMA_LINE='cc = {NINJA_GOMA_CC} $',
)
# A placeholder for the system detected configuration
DETECTED = cr.Config('DETECTED')
@@ -30,6 +35,20 @@ class NinjaBuilder(cr.Builder):
self._targets = []
def Build(self, context, targets, arguments):
+ # Make sure Goma is started if Ninja is set to use it.
+ # This may be redundant, but it currently improves reliability.
+ try:
+ with open(context.Get('NINJA_BUILD_FILE'), 'r') as f:
+ if f.readline().rstrip('\n') == context.Get('NINJA_GOMA_LINE'):
+ # Goma is active, so make sure it's started.
+ cr.Host.ExecuteSilently(
+ context,
+ '{NINJA_GOMA_CTL}',
+ 'ensure_start'
+ )
+ except IOError:
+ pass
+
build_arguments = [target.build_target for target in targets]
build_arguments.extend(arguments)
cr.Host.Execute(
« no previous file with comments | « no previous file | tools/cr/cr/base/host.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698