Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f9bb4d1

Browse files
authored
Made tools/gn error out if it can't find goma (#22591)
1 parent 74d40c1 commit f9bb4d1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tools/gn

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# Use of this source code is governed by a BSD-style license that can be
44
# found in the LICENSE file.
55

6+
from __future__ import absolute_import
7+
from __future__ import division
8+
from __future__ import print_function
9+
610
import argparse
711
import subprocess
812
import sys
@@ -223,6 +227,8 @@ def to_gn_args(args):
223227
gn_args['use_goma'] = True
224228
gn_args['goma_dir'] = depot_tools_bin_dir
225229
else:
230+
if args.goma:
231+
print("GOMA usage was specified but can't be found, falling back to local builds. Set the GOMA_DIR environment variable to fix GOMA.")
226232
gn_args['use_goma'] = False
227233
gn_args['goma_dir'] = None
228234

@@ -417,11 +423,11 @@ def main(argv):
417423
out_dir = get_out_dir(args)
418424
command.append(out_dir)
419425
command.append('--args=%s' % ' '.join(gn_args))
420-
print "Generating GN files in: %s" % out_dir
426+
print("Generating GN files in: %s" % out_dir)
421427
try:
422428
gn_call_result = subprocess.call(command, cwd=SRC_ROOT)
423429
except subprocess.CalledProcessError as exc:
424-
print "Failed to generate gn files: ", exc.returncode, exc.output
430+
print("Failed to generate gn files: ", exc.returncode, exc.output)
425431
sys.exit(1)
426432

427433
if gn_call_result == 0:
@@ -442,7 +448,7 @@ def main(argv):
442448
try:
443449
contents = subprocess.check_output(compile_cmd_gen_cmd, cwd=SRC_ROOT)
444450
except subprocess.CalledProcessError as exc:
445-
print "Failed to run ninja: ", exc.returncode, exc.output
451+
print("Failed to run ninja: ", exc.returncode, exc.output)
446452
sys.exit(1)
447453
compile_commands = open('%s/out/compile_commands.json' % SRC_ROOT, 'w+')
448454
compile_commands.write(contents)

0 commit comments

Comments
 (0)