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

Commit 07a9241

Browse files
committed
Merge pull request #67 from eseidelGoogle/goma
Add goma support to sky/tools/gn
2 parents 5c55b1f + 0fa26ad commit 07a9241

File tree

1 file changed

+19
-3
lines changed
  • sky/tools

1 file changed

+19
-3
lines changed

sky/tools/gn

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ def to_gn_args(args):
3131
gn_args["is_debug"] = args.debug
3232
gn_args["is_clang"] = args.target_os not in ['android']
3333

34-
# TODO(abarth): Add support for goma.
35-
gn_args["use_goma"] = False
36-
3734
if args.target_os == 'android':
3835
gn_args["target_os"] = "android"
3936
elif args.target_os == 'ios':
@@ -52,17 +49,36 @@ def to_gn_args(args):
5249
gn_args["target_cpu"] = 'arm'
5350
else:
5451
gn_args["target_cpu"] = 'x64'
52+
53+
goma_dir = os.environ.get('GOMA_DIR')
54+
goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
55+
if args.goma and goma_dir:
56+
gn_args['use_goma'] = True
57+
gn_args['goma_dir'] = goma_dir
58+
elif args.goma and os.path.exists(goma_home_dir):
59+
gn_args['use_goma'] = True
60+
gn_args['goma_dir'] = goma_home_dir
61+
else:
62+
gn_args['use_goma'] = False
63+
gn_args['goma_dir'] = None
64+
5565
return gn_args
5666

5767

5868
def main():
5969
parser = argparse.ArgumentParser(description='A script run` gn gen`.')
70+
6071
parser.add_argument('--debug', default=True)
6172
parser.add_argument('--release', default=False, dest='debug', action='store_false')
73+
6274
parser.add_argument('--target-os', type=str)
6375
parser.add_argument('--android', dest='target_os', action='store_const', const='android')
6476
parser.add_argument('--ios', dest='target_os', action='store_const', const='ios')
6577
parser.add_argument('--simulator', default=False)
78+
79+
parser.add_argument('--goma', default=True, action='store_true')
80+
parser.add_argument('--no-goma', dest='goma', action='store_false')
81+
6682
args = parser.parse_args()
6783

6884
command = ['gn', 'gen', '--check']

0 commit comments

Comments
 (0)