From 6a860326887fe48cb65e7ebe38ca717be2de6f5c Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Mon, 9 Sep 2019 18:03:40 +0000 Subject: [PATCH] Handle GOMA_DISABLED more precisely This updates the comments and code regarding GOMA_DISABLED to more precisely match its behavior and therefore avoid confusion. Bug: b/140312943 Change-Id: I6208de282bd5ebf1d88f98c1f905cfc626de792e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1786676 Commit-Queue: Bruce Dawson Reviewed-by: Takuto Ikuta --- autoninja.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/autoninja.py b/autoninja.py index 5aad538e3e..9ccdfa0c6c 100755 --- a/autoninja.py +++ b/autoninja.py @@ -82,14 +82,15 @@ elif os.path.exists(os.path.join(output_dir, 'rules.ninja')): use_goma = True break -# 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' in os.environ: +# If GOMA_DISABLED is set to "true", "t", "yes", "y", or "1" (case-insensitive) +# 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. +goma_disabled_env = os.environ.get('GOMA_DISABLED', '0').lower() +if goma_disabled_env in ['true', 't', 'yes', 'y', '1']: use_goma = False # Specify ninja.exe on Windows so that ninja.bat can call autoninja and not