@@ -214,6 +214,13 @@ def buildtools_dir():
214214def setup_goma(args):
215215 goma_gn_args = {}
216216
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+
217224 # When running in CI, the recipes use their own goma install, and take
218225 # care of starting and stopping the compiler proxy.
219226 running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
@@ -235,14 +242,16 @@ def setup_goma(args):
235242 if args.target_os == 'wasm' or args.web:
236243 goma_gn_args['use_goma'] = False
237244 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):
240249 goma_gn_args['use_goma'] = True
241250 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):
243252 goma_gn_args['use_goma'] = True
244253 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):
246255 goma_gn_args['use_goma'] = True
247256 goma_gn_args['goma_dir'] = goma_home_dir
248257 elif args.goma:
@@ -870,7 +879,7 @@ def parse_args(args):
870879 help='Do not build the host-side development artifacts.'
871880 )
872881
873- parser.add_argument('--goma', default=True , action='store_true')
882+ parser.add_argument('--goma', default=None , action='store_true')
874883 parser.add_argument('--no-goma', dest='goma', action='store_false')
875884 parser.add_argument(
876885 '--xcode-symlinks',
0 commit comments