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

Commit e23205c

Browse files
committed
RBE
1 parent 249cd28 commit e23205c

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

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: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,56 @@ def buildtools_dir():
214214
return '%s-%s' % (host_os, host_cpu)
215215

216216

217+
def setup_rbe(args):
218+
rbe_gn_args = {}
219+
if get_host_os() not in ['linux']:
220+
print('--rbe flag has no effect. RBE is currently only supported on Linux.')
221+
return rbe_gn_args
222+
223+
# When running in CI, the recipes use their own rbe install, and take
224+
# care of starting and stopping the compiler proxy.
225+
running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
226+
227+
cipd_reclient_dir = os.path.join(
228+
SRC_ROOT,
229+
'buildtools',
230+
buildtools_dir(),
231+
'reclient',
232+
)
233+
234+
rbe_gn_args['use_rbe'] = args.rbe
235+
if rbe_gn_args['use_rbe'] and sys.platform == 'darwin':
236+
if (not running_on_luci or args.xcode_symlinks or
237+
os.getenv('FLUTTER_GOMA_CREATE_XCODE_SYMLINKS', '0') == '1'):
238+
rbe_gn_args['create_xcode_symlinks'] = True
239+
240+
# Bootstrap reproxy if not running in CI.
241+
if rbe_gn_args['use_rbe'] and not running_on_luci:
242+
bootstrap_path = os.path.join(cipd_reclient_dir, 'bootstrap')
243+
reproxy_path = os.path.join(cipd_reclient_dir, 'reproxy')
244+
rbe_cfg_path = os.path.join(SRC_ROOT, 'build', 'rbe.cfg')
245+
bootstrap_cmd = [
246+
bootstrap_path,
247+
'--re_proxy=' + reproxy_path,
248+
'--automatic_auth=true',
249+
'--cfg=' + rbe_cfg_path,
250+
]
251+
try:
252+
subprocess.call(bootstrap_cmd, cwd=SRC_ROOT)
253+
except subprocess.CalledProcessError as exc:
254+
print('Failed to boostrap reproxy: ', exc.returncode, exc.output)
255+
return {}
256+
257+
return rbe_gn_args
258+
259+
217260
def setup_goma(args):
218261
goma_gn_args = {}
262+
# If RBE is requested, don't try to use goma.
263+
if args.rbe:
264+
goma_gn_args['use_goma'] = False
265+
goma_gn_args['goma_dir'] = None
266+
return goma_gn_args
219267

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

291339
gn_args.update(setup_goma(args))
292340

341+
gn_args.update(setup_rbe(args))
342+
293343
# If building for WASM, set the GN args using 'to_gn_wasm_args' as most
294344
# of the Flutter SDK specific arguments are unused.
295345
if args.target_os == 'wasm' or args.web:
@@ -913,6 +963,9 @@ def parse_args(args):
913963
help='Do not build the host-side development artifacts.'
914964
)
915965

966+
parser.add_argument('--rbe', default=None, action='store_true')
967+
parser.add_argument('--no-rbe', dest='rbe', action='store_false')
968+
916969
parser.add_argument('--goma', default=None, action='store_true')
917970
parser.add_argument('--no-goma', dest='goma', action='store_false')
918971
parser.add_argument(

0 commit comments

Comments
 (0)