Commit 1f767e17 authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Fix autoninja.py for ninja -t compatibility

The -t tools in ninja fail if -j or -l are specified. So, autoninja.py
needs to watch for -t and omit -j and -l if it is noticed.

R=sebmarchand@chromium.org
BUG=740227

Change-Id: I1418193daeab154178d15be60ab09551bacaf3af
Reviewed-on: https://chromium-review.googlesource.com/563775Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
parent 7466d1a9
......@@ -15,11 +15,15 @@ import os
import re
import sys
# The -t tools are incompatible with -j and -l
t_specified = False
j_specified = False
output_dir = '.'
for index, arg in enumerate(sys.argv[1:]):
if arg == '-j':
j_specified = True
if arg == '-t':
t_specified = True
if arg == '-C':
# + 1 to get the next argument and +1 because we trimmed off sys.argv[0]
output_dir = sys.argv[index + 2]
......@@ -43,7 +47,7 @@ else:
args = ['ninja'] + sys.argv[1:]
num_cores = multiprocessing.cpu_count()
if not j_specified:
if not j_specified and not t_specified:
if use_goma:
args.append('-j')
core_multiplier = int(os.environ.get("NINJA_CORE_MULTIPLIER", "20"))
......@@ -55,11 +59,12 @@ if not j_specified:
args.append('-j')
args.append('%d' % (num_cores + core_addition))
# Specify a maximum CPU load so that running builds in two different command
# prompts won't overload the system too much. This is not reliable enough to
# be used to auto-adjust between goma/non-goma loads, but it is a nice
# fallback load balancer.
args.append('-l')
args.append('%d' % num_cores)
if not t_specified:
# Specify a maximum CPU load so that running builds in two different command
# prompts won't overload the system too much. This is not reliable enough to
# be used to auto-adjust between goma/non-goma loads, but it is a nice
# fallback load balancer.
args.append('-l')
args.append('%d' % num_cores)
print ' '.join(args)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment