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

Commit 7fa6538

Browse files
committed
Download and use goma client from cipd
1 parent aec3b70 commit 7fa6538

File tree

2 files changed

+91
-2
lines changed

2 files changed

+91
-2
lines changed

DEPS

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ vars = {
3939
# The list of revisions for these tools comes from Fuchsia, here:
4040
# https://fuchsia.googlesource.com/integration/+/HEAD/toolchain
4141
# If there are problems with the toolchain, contact fuchsia-toolchain@.
42-
'clang_version': 'git_revision:e8cfbfd05a951b85f80156dffc8eeecb34c7271c',
42+
'clang_version': 'git_revision:20d06c833d833ef6b2d0f519cc4a7998d49a2803',
43+
44+
# The goma version and the clang version can be tightly coupled. If goma
45+
# stops working on a clang roll, this may need to be updated.
46+
'goma_version': ' git_revision:41b3bcb64014144a844153fd5588c36411fffb56',
4347

4448
# When updating the Dart revision, ensure that all entries that are
4549
# dependencies of Dart are also updated to match the entries in the
@@ -98,7 +102,12 @@ vars = {
98102
"checkout_llvm": False,
99103

100104
# Setup Git hooks by default.
101-
"setup_githooks": True,
105+
'setup_githooks': True,
106+
107+
# When this is true, the goma client will be downloaded from cipd, and
108+
# the engine build will prefer to use this client over a client that is
109+
# specified by GOMA_DIR, or installed in the default goma install location.
110+
'download_goma': False,
102111

103112
# This is not downloaded be default because it increases the
104113
# `gclient sync` time by between 1 and 3 minutes. This option is enabled
@@ -830,6 +839,41 @@ deps = {
830839
'dep_type': 'cipd',
831840
},
832841

842+
843+
# GOMA
844+
'src/buildtools/mac-x64/goma': {
845+
'packages': [
846+
{
847+
'package': 'fuchsia/third_party/goma/client/mac-amd64',
848+
'version': Var('goma_version'),
849+
}
850+
],
851+
'condition': 'download_goma and host_os == "mac"',
852+
'dep_type': 'cipd',
853+
},
854+
855+
'src/buildtools/linux-x64/goma': {
856+
'packages': [
857+
{
858+
'package': 'fuchsia/third_party/goma/client/linux-amd64',
859+
'version': Var('goma_version'),
860+
}
861+
],
862+
'condition': 'download_goma and host_os == "linux"',
863+
'dep_type': 'cipd',
864+
},
865+
866+
'src/buildtools/windows-x64/goma': {
867+
'packages': [
868+
{
869+
'package': 'fuchsia/third_party/goma/client/windows-amd64',
870+
'version': Var('goma_version'),
871+
}
872+
],
873+
'condition': 'download_goma and download_windows_deps',
874+
'dep_type': 'cipd',
875+
},
876+
833877
# Get the SDK from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core at the 'latest' tag
834878
# Get the toolchain from https://chrome-infra-packages.appspot.com/p/fuchsia/clang at the 'goma' tag
835879
'src/fuchsia/sdk/mac': {

tools/gn

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,35 @@ def get_target_cpu(args):
199199
return 'x64'
200200

201201

202+
def buildtools_dir():
203+
host_os = get_host_os()
204+
host_cpu = get_host_cpu()
205+
if host_os == 'win':
206+
host_os = 'windows'
207+
if host_os == 'mac' and host_cpu == 'arm64':
208+
host_cpu = 'x64'
209+
return '%s-%s' % (host_os, host_cpu)
210+
211+
212+
def goma_ensure_start(goma_dir):
213+
goma_ctl_path = os.path.join(goma_dir, 'goma_ctl.py')
214+
command = ['python3', goma_ctl_path, 'ensure_start']
215+
try:
216+
output = subprocess.check_output(command, stderr=subprocess.STDOUT)
217+
print(output)
218+
except subprocess.CalledProcessError:
219+
print(
220+
'Failed to start goma:\n%s\nEnsure it is started by manually running:\n'
221+
'$ %s\n' % (output.decode('utf-8'), ' '.join(command))
222+
)
223+
224+
202225
def setup_goma(args):
203226
goma_gn_args = {}
204227

228+
# Prefer the goma fetched by gclient.
229+
cipd_goma_dir = os.path.join(SRC_ROOT, 'buildtools', buildtools_dir(), 'goma')
230+
205231
goma_dir = os.environ.get('GOMA_DIR')
206232
goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
207233

@@ -214,6 +240,9 @@ def setup_goma(args):
214240
goma_gn_args['use_goma'] = False
215241
goma_gn_args['goma_dir'] = None
216242
print('Disabling GOMA for wasm builds, it is not supported yet.')
243+
elif args.goma and os.path.exists(cipd_goma_dir):
244+
goma_gn_args['use_goma'] = True
245+
goma_gn_args['goma_dir'] = cipd_goma_dir
217246
elif args.goma and goma_dir and os.path.exists(goma_dir):
218247
goma_gn_args['use_goma'] = True
219248
goma_gn_args['goma_dir'] = goma_dir
@@ -237,6 +266,9 @@ def setup_goma(args):
237266
os.getenv('FLUTTER_GOMA_CREATE_XCODE_SYMLINKS', '0') == '1'):
238267
goma_gn_args['create_xcode_symlinks'] = True
239268

269+
if goma_gn_args['use_goma'] and args.goma_ensure_start:
270+
goma_ensure_start(goma_gn_args['goma_dir'])
271+
240272
return goma_gn_args
241273

242274

@@ -1070,6 +1102,19 @@ def parse_args(args):
10701102
help='Do not run GN. Instead configure the Impeller cmake example build.',
10711103
)
10721104

1105+
parser.add_argument(
1106+
'--goma-ensure-start',
1107+
default=True,
1108+
action='store_true',
1109+
help='Ensure that the goma compiler proxy is running.',
1110+
)
1111+
parser.add_argument(
1112+
'--no-goma-ensure-start',
1113+
dest='goma_ensure_start',
1114+
action='store_false',
1115+
help='Do not ensure that the goma compiler proxy is running.',
1116+
)
1117+
10731118
# Sanitizers.
10741119
parser.add_argument('--asan', default=False, action='store_true')
10751120
parser.add_argument('--lsan', default=False, action='store_true')

0 commit comments

Comments
 (0)