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

Commit 0f5dcd2

Browse files
committed
Download and use goma client from cipd
1 parent e1e07da commit 0f5dcd2

File tree

2 files changed

+102
-4
lines changed

2 files changed

+102
-4
lines changed

DEPS

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ 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 using the value
46+
# from the 'integration' tag of
47+
# https://chrome-infra-packages.appspot.com/p/fuchsia/third_party/goma/client
48+
'goma_version': ' git_revision:41b3bcb64014144a844153fd5588c36411fffb56',
4349

4450
# When updating the Dart revision, ensure that all entries that are
4551
# dependencies of Dart are also updated to match the entries in the
@@ -98,7 +104,12 @@ vars = {
98104
"checkout_llvm": False,
99105

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

103114
# This is not downloaded be default because it increases the
104115
# `gclient sync` time by between 1 and 3 minutes. This option is enabled
@@ -830,6 +841,40 @@ deps = {
830841
'dep_type': 'cipd',
831842
},
832843

844+
# GOMA
845+
'src/buildtools/mac-x64/goma': {
846+
'packages': [
847+
{
848+
'package': 'fuchsia/third_party/goma/client/mac-amd64',
849+
'version': Var('goma_version'),
850+
}
851+
],
852+
'condition': 'use_cipd_goma and host_os == "mac"',
853+
'dep_type': 'cipd',
854+
},
855+
856+
'src/buildtools/linux-x64/goma': {
857+
'packages': [
858+
{
859+
'package': 'fuchsia/third_party/goma/client/linux-amd64',
860+
'version': Var('goma_version'),
861+
}
862+
],
863+
'condition': 'use_cipd_goma and host_os == "linux"',
864+
'dep_type': 'cipd',
865+
},
866+
867+
'src/buildtools/windows-x64/goma': {
868+
'packages': [
869+
{
870+
'package': 'fuchsia/third_party/goma/client/windows-amd64',
871+
'version': Var('goma_version'),
872+
}
873+
],
874+
'condition': 'use_cipd_goma and download_windows_deps',
875+
'dep_type': 'cipd',
876+
},
877+
833878
# Get the SDK from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core at the 'latest' tag
834879
# Get the toolchain from https://chrome-infra-packages.appspot.com/p/fuchsia/clang at the 'goma' tag
835880
'src/fuchsia/sdk/mac': {
@@ -965,6 +1010,36 @@ hooks = [
9651010
'src/flutter/tools/activate_emsdk.py',
9661011
]
9671012
},
1013+
{
1014+
'name': 'Start compiler proxy',
1015+
'pattern': '.',
1016+
'condition': 'use_cipd_goma and host_os == "mac"',
1017+
'action': [
1018+
'python3',
1019+
'src/buildtools/mac-x64/goma/goma_ctl.py',
1020+
'ensure_start'
1021+
]
1022+
},
1023+
{
1024+
'name': 'Start compiler proxy',
1025+
'pattern': '.',
1026+
'condition': 'use_cipd_goma and host_os == "linux"',
1027+
'action': [
1028+
'python3',
1029+
'src/buildtools/linux-x64/goma/goma_ctl.py',
1030+
'ensure_start'
1031+
]
1032+
},
1033+
{
1034+
'name': 'Start compiler proxy',
1035+
'pattern': '.',
1036+
'condition': 'use_cipd_goma and download_windows_deps',
1037+
'action': [
1038+
'python3',
1039+
'src/buildtools/windows-x64/goma/goma_ctl.py',
1040+
'ensure_start'
1041+
]
1042+
},
9681043
{
9691044
'name': 'Setup githooks',
9701045
'pattern': '.',

tools/gn

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,32 @@ 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+
202212
def setup_goma(args):
203213
goma_gn_args = {}
204214

215+
# When running in CI, the recipes use their own goma install, and take
216+
# care of starting and stopping the compiler proxy.
217+
running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
218+
219+
# Prefer the goma fetched by gclient if it exists.
220+
cipd_goma_dir = os.path.join(SRC_ROOT, 'buildtools', buildtools_dir(), 'goma')
221+
222+
# Next, if GOMA_DIR is set, use that install.
205223
goma_dir = os.environ.get('GOMA_DIR')
206-
goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
207224

225+
# Finally, look for goma in the install location recommended in our
226+
# documentation.
227+
goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
208228
# GOMA has a different default (home) path on gWindows.
209229
if not os.path.exists(goma_home_dir) and sys.platform.startswith(
210230
('cygwin', 'win')):
@@ -214,6 +234,9 @@ def setup_goma(args):
214234
goma_gn_args['use_goma'] = False
215235
goma_gn_args['goma_dir'] = None
216236
print('Disabling GOMA for wasm builds, it is not supported yet.')
237+
elif args.goma and not running_on_luci and os.path.exists(cipd_goma_dir):
238+
goma_gn_args['use_goma'] = True
239+
goma_gn_args['goma_dir'] = cipd_goma_dir
217240
elif args.goma and goma_dir and os.path.exists(goma_dir):
218241
goma_gn_args['use_goma'] = True
219242
goma_gn_args['goma_dir'] = goma_dir
@@ -233,7 +256,7 @@ def setup_goma(args):
233256
goma_gn_args['goma_dir'] = None
234257

235258
if goma_gn_args['use_goma'] and sys.platform == 'darwin':
236-
if (os.environ.get('LUCI_CONTEXT') is None or args.xcode_symlinks or
259+
if (not running_on_luci or args.xcode_symlinks or
237260
os.getenv('FLUTTER_GOMA_CREATE_XCODE_SYMLINKS', '0') == '1'):
238261
goma_gn_args['create_xcode_symlinks'] = True
239262

0 commit comments

Comments
 (0)