@@ -214,6 +214,13 @@ def buildtools_dir():
214
214
def setup_goma(args):
215
215
goma_gn_args = {}
216
216
217
+ # args.goma has three states, True (--goma), False (--no-goma), and
218
+ # None (default). In True mode, we force GOMA to be used (and fail
219
+ # if we cannot enable it) unless the selected target definitely does
220
+ # not support it (in which case we print a warning). In False mode,
221
+ # we disable GOMA regardless. In None mode, we enable it if we can
222
+ # autodetect a configuration, and otherwise disable it.
223
+
217
224
# When running in CI, the recipes use their own goma install, and take
218
225
# care of starting and stopping the compiler proxy.
219
226
running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
@@ -235,14 +242,16 @@ def setup_goma(args):
235
242
if args.target_os == 'wasm' or args.web:
236
243
goma_gn_args['use_goma'] = False
237
244
goma_gn_args['goma_dir'] = None
238
- print('Disabling GOMA for wasm builds, it is not supported yet.')
239
- elif args.goma and not running_on_luci and os.path.exists(cipd_goma_dir):
245
+ if args.goma:
246
+ print('Disabling GOMA for wasm builds, it is not supported yet.')
247
+ elif args.goma is not False and not running_on_luci and os.path.exists(
248
+ cipd_goma_dir):
240
249
goma_gn_args['use_goma'] = True
241
250
goma_gn_args['goma_dir'] = cipd_goma_dir
242
- elif args.goma and goma_dir and os.path.exists(goma_dir):
251
+ elif args.goma is not False and goma_dir and os.path.exists(goma_dir):
243
252
goma_gn_args['use_goma'] = True
244
253
goma_gn_args['goma_dir'] = goma_dir
245
- elif args.goma and os.path.exists(goma_home_dir):
254
+ elif args.goma is not False and os.path.exists(goma_home_dir):
246
255
goma_gn_args['use_goma'] = True
247
256
goma_gn_args['goma_dir'] = goma_home_dir
248
257
elif args.goma:
@@ -870,7 +879,7 @@ def parse_args(args):
870
879
help='Do not build the host-side development artifacts.'
871
880
)
872
881
873
- parser.add_argument('--goma', default=True , action='store_true')
882
+ parser.add_argument('--goma', default=None , action='store_true')
874
883
parser.add_argument('--no-goma', dest='goma', action='store_false')
875
884
parser.add_argument(
876
885
'--xcode-symlinks',
0 commit comments