Skip to content

Commit

Permalink
Teach autoninja.py to support GOMA_DISABLED env var
Browse files Browse the repository at this point in the history
When GOMA_DISABLED is set goma will use the local compiler. Autoninja
needs to understand this in order to avoid requesting too much
parallelism.

Change-Id: Ic124893dd583a401d0d9ad7fbd27ee9b6715fcfe
Reviewed-on: https://chromium-review.googlesource.com/1015402
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
  • Loading branch information
randomascii authored and Commit Bot committed Apr 18, 2018
1 parent adc953f commit 85c7502
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions autoninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@

use_goma = False
try:
with open(os.path.join(output_dir, 'args.gn')) as file_handle:
for line in file_handle:
# This regex pattern copied from create_installer_archive.py
m = re.match('^\s*use_goma\s*=\s*true(\s*$|\s*#.*$)', line)
if m:
use_goma = True
# If GOMA_DISABLED is set (to anything) then gomacc will use the local
# compiler instead of doing a goma compile. This is convenient if you want
# to briefly disable goma. It avoids having to rebuild the world when
# transitioning between goma/non-goma builds. However, it is not as fast as
# doing a "normal" non-goma build because an extra process is created for each
# compile step. Checking this environment variable ensures that autoninja uses
# an appropriate -j value in this situation.
if 'GOMA_DISABLED' not in os.environ:
with open(os.path.join(output_dir, 'args.gn')) as file_handle:
for line in file_handle:
# This regex pattern copied from create_installer_archive.py
m = re.match('^\s*use_goma\s*=\s*true(\s*$|\s*#.*$)', line)
if m:
use_goma = True
except IOError:
pass

Expand Down

0 comments on commit 85c7502

Please sign in to comment.