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

Commit 96b93de

Browse files
committed
RBE
1 parent 249cd28 commit 96b93de

2 files changed

Lines changed: 126 additions & 0 deletions

File tree

DEPS

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ vars = {
4747
# https://chrome-infra-packages.appspot.com/p/fuchsia/third_party/goma/client
4848
'goma_version': ' git_revision:41b3bcb64014144a844153fd5588c36411fffb56',
4949

50+
'reclient_version': 'git_revision:81e819b39d4743462857cc55430d898b9fcca1af',
51+
52+
'gcloud_version': 'version:2@444.0.0.chromium.3',
53+
5054
# When updating the Dart revision, ensure that all entries that are
5155
# dependencies of Dart are also updated to match the entries in the
5256
# Dart SDK's DEPS file for that revision of Dart. The DEPS file for
@@ -880,6 +884,30 @@ deps = {
880884
'dep_type': 'cipd',
881885
},
882886

887+
# reclient.
888+
'src/buildtools/linux-x64/reclient': {
889+
'packages': [
890+
{
891+
'package': 'infra/rbe/client/${{platform}}',
892+
'version': Var('reclient_version'),
893+
}
894+
],
895+
'condition': 'host_os == "linux" and host_cpu == "x64"',
896+
'dep_type': 'cipd',
897+
},
898+
899+
# gcloud
900+
'src/buildtools/linux-x64/gcloud': {
901+
'packages': [
902+
{
903+
'package': 'infra/3pp/tools/gcloud/${{platform}}',
904+
'version': Var('gcloud_version'),
905+
}
906+
],
907+
'condition': 'host_os == "linux" and host_cpu == "x64"',
908+
'dep_type': 'cipd',
909+
},
910+
883911
# Get the SDK from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core at the 'latest' tag
884912
# Get the toolchain from https://chrome-infra-packages.appspot.com/p/fuchsia/clang at the 'goma' tag
885913
'src/fuchsia/sdk/mac': {

tools/gn

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,69 @@ def buildtools_dir():
214214
return '%s-%s' % (host_os, host_cpu)
215215

216216

217+
def setup_rbe(args):
218+
rbe_gn_args = {}
219+
# RBE is default-off. If it is not asked for, then silently keep all default
220+
# flag values.
221+
if not args.rbe:
222+
return rbe_gn_args
223+
224+
if get_host_os() not in ['linux']:
225+
print(
226+
'The --rbe flag has no effect. RBE is currently only supported on Linux.'
227+
)
228+
return rbe_gn_args
229+
230+
rbe_gn_args['use_rbe'] = True
231+
232+
# When running in CI, the recipes use their own rbe install, and take
233+
# care of starting and stopping the compiler proxy.
234+
running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
235+
236+
# Bootstrap reproxy if not running in CI.
237+
if not running_on_luci:
238+
cipd_reclient_dir = os.path.join(
239+
SRC_ROOT,
240+
'buildtools',
241+
buildtools_dir(),
242+
'reclient',
243+
)
244+
bootstrap_path = os.path.join(cipd_reclient_dir, 'bootstrap')
245+
reproxy_path = os.path.join(cipd_reclient_dir, 'reproxy')
246+
rbe_cfg_path = os.path.join(SRC_ROOT, 'build', 'rbe.cfg')
247+
bootstrap_cmd = [
248+
bootstrap_path,
249+
'--re_proxy=' + reproxy_path,
250+
'--automatic_auth=true',
251+
'--cfg=' + rbe_cfg_path,
252+
]
253+
try:
254+
subprocess.call(bootstrap_cmd, cwd=SRC_ROOT)
255+
except subprocess.CalledProcessError as exc:
256+
print('Failed to boostrap reproxy: ', exc.returncode, exc.output)
257+
return {}
258+
259+
if args.rbe_server_address:
260+
rbe_gn_args['rbe_server_address'] = args.rbe_server_address
261+
if args.rbe_exec_strategy:
262+
rbe_gn_args['rbe_exec_strategy'] = args.rbe_exec_strategy
263+
if args.rbe_dial_timeout:
264+
rbe_gn_args['rbe_dial_timeout'] = args.rbe_dial_timeout
265+
if args.rbe_platform:
266+
rbe_gn_args['rbe_platform'] = args.rbe_platform
267+
if args.rbe_dir:
268+
rbe_gn_args['rbe_dir'] = args.rbe_dir
269+
270+
return rbe_gn_args
271+
272+
217273
def setup_goma(args):
218274
goma_gn_args = {}
275+
# If RBE is requested, don't try to use goma.
276+
if args.rbe:
277+
goma_gn_args['use_goma'] = False
278+
goma_gn_args['goma_dir'] = None
279+
return goma_gn_args
219280

220281
# args.goma has three states, True (--goma), False (--no-goma), and
221282
# None (default). In True mode, we force GOMA to be used (and fail
@@ -290,6 +351,8 @@ def to_gn_args(args):
290351

291352
gn_args.update(setup_goma(args))
292353

354+
gn_args.update(setup_rbe(args))
355+
293356
# If building for WASM, set the GN args using 'to_gn_wasm_args' as most
294357
# of the Flutter SDK specific arguments are unused.
295358
if args.target_os == 'wasm' or args.web:
@@ -913,6 +976,41 @@ def parse_args(args):
913976
help='Do not build the host-side development artifacts.'
914977
)
915978

979+
parser.add_argument('--rbe', default=None, action='store_true')
980+
parser.add_argument('--no-rbe', dest='rbe', action='store_false')
981+
parser.add_argument(
982+
'--rbe-server-address',
983+
default=None,
984+
type=str,
985+
help='The reproxy serveraddress'
986+
)
987+
parser.add_argument(
988+
'--rbe-exec-strategy',
989+
default=None,
990+
type=str,
991+
help='The RBE execution strategy.',
992+
choices=['local', 'remote', 'remote_local_fallback', 'racing']
993+
)
994+
parser.add_argument(
995+
'--rbe-dial-timeout',
996+
default=None,
997+
type=str,
998+
help='The timeout for connecting to the local reproxy server.',
999+
)
1000+
parser.add_argument(
1001+
'--rbe-platform',
1002+
default=None,
1003+
type=str,
1004+
help='The RBE "platform" string. This is used to identify remote platform '
1005+
'settings like the docker image to use to run the command.'
1006+
)
1007+
parser.add_argument(
1008+
'--rbe-dir',
1009+
default=None,
1010+
type=str,
1011+
help='The location of the reclient binaries.'
1012+
)
1013+
9161014
parser.add_argument('--goma', default=None, action='store_true')
9171015
parser.add_argument('--no-goma', dest='goma', action='store_false')
9181016
parser.add_argument(

0 commit comments

Comments
 (0)