@ -15,11 +15,15 @@ import os
import re
import re
import sys
import sys
# The -t tools are incompatible with -j and -l
t_specified = False
j_specified = False
j_specified = False
output_dir = ' . '
output_dir = ' . '
for index , arg in enumerate ( sys . argv [ 1 : ] ) :
for index , arg in enumerate ( sys . argv [ 1 : ] ) :
if arg == ' -j ' :
if arg == ' -j ' :
j_specified = True
j_specified = True
if arg == ' -t ' :
t_specified = True
if arg == ' -C ' :
if arg == ' -C ' :
# + 1 to get the next argument and +1 because we trimmed off sys.argv[0]
# + 1 to get the next argument and +1 because we trimmed off sys.argv[0]
output_dir = sys . argv [ index + 2 ]
output_dir = sys . argv [ index + 2 ]
@ -43,7 +47,7 @@ else:
args = [ ' ninja ' ] + sys . argv [ 1 : ]
args = [ ' ninja ' ] + sys . argv [ 1 : ]
num_cores = multiprocessing . cpu_count ( )
num_cores = multiprocessing . cpu_count ( )
if not j_specified :
if not j_specified and not t_specified :
if use_goma :
if use_goma :
args . append ( ' -j ' )
args . append ( ' -j ' )
core_multiplier = int ( os . environ . get ( " NINJA_CORE_MULTIPLIER " , " 20 " ) )
core_multiplier = int ( os . environ . get ( " NINJA_CORE_MULTIPLIER " , " 20 " ) )
@ -55,11 +59,12 @@ if not j_specified:
args . append ( ' -j ' )
args . append ( ' -j ' )
args . append ( ' %d ' % ( num_cores + core_addition ) )
args . append ( ' %d ' % ( num_cores + core_addition ) )
# Specify a maximum CPU load so that running builds in two different command
if not t_specified :
# prompts won't overload the system too much. This is not reliable enough to
# Specify a maximum CPU load so that running builds in two different command
# be used to auto-adjust between goma/non-goma loads, but it is a nice
# prompts won't overload the system too much. This is not reliable enough to
# fallback load balancer.
# be used to auto-adjust between goma/non-goma loads, but it is a nice
args . append ( ' -l ' )
# fallback load balancer.
args . append ( ' %d ' % num_cores )
args . append ( ' -l ' )
args . append ( ' %d ' % num_cores )
print ' ' . join ( args )
print ' ' . join ( args )