Skip to content

Commit

Permalink
Make GOMA state automatic by default
Browse files Browse the repository at this point in the history
We used to default to force-enabled, which would fail on non-GOMA setups.
  • Loading branch information
Hixie committed Jul 12, 2023
1 parent feaadf8 commit a13d858
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ def buildtools_dir():
def setup_goma(args):
goma_gn_args = {}

# args.goma has three states, True (--goma), False (--no-goma), and
# None (default). In True mode, we force GOMA to be used (and fail
# if we cannot enable it) unless the selected target definitely does
# not support it (in which case we print a warning). In False mode,
# we disable GOMA regardless. In None mode, we enable it if we can
# autodetect a configuration, and otherwise disable it.

# When running in CI, the recipes use their own goma install, and take
# care of starting and stopping the compiler proxy.
running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
Expand All @@ -235,14 +242,16 @@ def setup_goma(args):
if args.target_os == 'wasm' or args.web:
goma_gn_args['use_goma'] = False
goma_gn_args['goma_dir'] = None
print('Disabling GOMA for wasm builds, it is not supported yet.')
elif args.goma and not running_on_luci and os.path.exists(cipd_goma_dir):
if args.goma:
print('Disabling GOMA for wasm builds, it is not supported yet.')
elif args.goma is not False and not running_on_luci and os.path.exists(
cipd_goma_dir):
goma_gn_args['use_goma'] = True
goma_gn_args['goma_dir'] = cipd_goma_dir
elif args.goma and goma_dir and os.path.exists(goma_dir):
elif args.goma is not False and goma_dir and os.path.exists(goma_dir):
goma_gn_args['use_goma'] = True
goma_gn_args['goma_dir'] = goma_dir
elif args.goma and os.path.exists(goma_home_dir):
elif args.goma is not False and os.path.exists(goma_home_dir):
goma_gn_args['use_goma'] = True
goma_gn_args['goma_dir'] = goma_home_dir
elif args.goma:
Expand Down Expand Up @@ -870,7 +879,7 @@ def parse_args(args):
help='Do not build the host-side development artifacts.'
)

parser.add_argument('--goma', default=True, action='store_true')
parser.add_argument('--goma', default=None, action='store_true')
parser.add_argument('--no-goma', dest='goma', action='store_false')
parser.add_argument(
'--xcode-symlinks',
Expand Down

0 comments on commit a13d858

Please sign in to comment.