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

Commit b7f8d50

Browse files
authored
Relands: Refactors RBE support (#49660)
Relands #49416
1 parent 35336ad commit b7f8d50

File tree

7 files changed

+135
-25
lines changed

7 files changed

+135
-25
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,9 @@ app.*.symbols
130130

131131
# Prebuilt binaries.
132132
/prebuilts/
133+
134+
# GN build support for protobufs vended by Fuchsia.
133135
/build/secondary/third_party/protobuf
136+
137+
# RBE support configurations and scripts vended from CIPD
138+
/build/rbe

DEPS

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ vars = {
5353
# https://chrome-infra-packages.appspot.com/p/fuchsia/third_party/goma/client
5454
'goma_version': ' git_revision:41b3bcb64014144a844153fd5588c36411fffb56',
5555

56-
'reclient_version': 'git_revision:81e819b39d4743462857cc55430d898b9fcca1af',
56+
'reclient_version': 'git_revision:f3883c2237b0eb9cc9524cb571b5ab8378f257e4',
5757

5858
'gcloud_version': 'version:[email protected]',
5959

@@ -126,6 +126,10 @@ vars = {
126126
# specified by GOMA_DIR, or installed in the default goma install location.
127127
'use_cipd_goma': False,
128128

129+
# When this is true, the Flutter Engine's configuration files and scripts for
130+
# RBE will be downloaded from CIPD. This option is only usable by Googlers.
131+
'use_rbe': False,
132+
129133
# This is not downloaded be default because it increases the
130134
# `gclient sync` time by between 1 and 3 minutes. This option is enabled
131135
# in flutter/ci/builders/mac_impeller_cmake_example.json, and is likely to
@@ -266,7 +270,7 @@ allowed_hosts = [
266270
]
267271

268272
deps = {
269-
'src': 'https://github.com/flutter/buildroot.git' + '@' + '8c274b21f1ad4f2aec0a5e0ae8f4264393045b4b',
273+
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a43582b52d361bc3da156a8e6eab6dd947ca339d',
270274

271275
'src/flutter/third_party/rapidjson':
272276
Var('flutter_git') + '/third_party/rapidjson' + '@' + 'ef3564c5c8824989393b87df25355baf35ff544b',
@@ -843,7 +847,7 @@ deps = {
843847
'version': Var('clang_version'),
844848
}
845849
],
846-
'condition': 'host_os == "linux" and host_cpu == "x64"',
850+
'condition': 'host_os == "linux" or host_os == "mac"',
847851
'dep_type': 'cipd',
848852
},
849853

@@ -903,15 +907,48 @@ deps = {
903907
'dep_type': 'cipd',
904908
},
905909

906-
# reclient.
910+
# RBE binaries and configs.
907911
'src/buildtools/linux-x64/reclient': {
908912
'packages': [
909913
{
910914
'package': 'infra/rbe/client/${{platform}}',
911915
'version': Var('reclient_version'),
912916
}
913917
],
914-
'condition': 'host_os == "linux" and host_cpu == "x64"',
918+
'condition': 'use_rbe and host_os == "linux" and host_cpu == "x64"',
919+
'dep_type': 'cipd',
920+
},
921+
922+
'src/buildtools/mac-arm64/reclient': {
923+
'packages': [
924+
{
925+
'package': 'infra/rbe/client/${{platform}}',
926+
'version': Var('reclient_version'),
927+
}
928+
],
929+
'condition': 'use_rbe and host_os == "mac" and host_cpu == "arm64"',
930+
'dep_type': 'cipd',
931+
},
932+
933+
'src/buildtools/mac-x64/reclient': {
934+
'packages': [
935+
{
936+
'package': 'infra/rbe/client/${{platform}}',
937+
'version': Var('reclient_version'),
938+
}
939+
],
940+
'condition': 'use_rbe and host_os == "mac" and host_cpu == "x64"',
941+
'dep_type': 'cipd',
942+
},
943+
944+
'src/flutter/build/rbe': {
945+
'packages': [
946+
{
947+
'package': 'flutter_internal/rbe/reclient_cfgs',
948+
'version': 'U42C0v8jI-_YREjd8rbDEt0evvqvLWJ_NTkaiJ_Clt8C',
949+
}
950+
],
951+
'condition': 'use_rbe',
915952
'dep_type': 'cipd',
916953
},
917954

@@ -923,7 +960,18 @@ deps = {
923960
'version': Var('gcloud_version'),
924961
}
925962
],
926-
'condition': 'host_os == "linux" and host_cpu == "x64"',
963+
'condition': 'use_rbe and host_os == "linux" and host_cpu == "x64"',
964+
'dep_type': 'cipd',
965+
},
966+
967+
'src/buildtools/mac-arm64/gcloud': {
968+
'packages': [
969+
{
970+
'package': 'infra/3pp/tools/gcloud/${{platform}}',
971+
'version': Var('gcloud_version'),
972+
}
973+
],
974+
'condition': 'use_rbe and host_os == "mac" and host_cpu == "arm64"',
927975
'dep_type': 'cipd',
928976
},
929977

ci/builders/linux_android_emulator.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"kvm=1",
88
"cores=8"
99
],
10+
"gclient_variables": {
11+
"use_rbe": true
12+
},
1013
"gn": [
1114
"--android",
1215
"--android-cpu=x64",
@@ -69,6 +72,9 @@
6972
"kvm=1",
7073
"cores=8"
7174
],
75+
"gclient_variables": {
76+
"use_rbe": true
77+
},
7278
"gn": [
7379
"--android",
7480
"--android-cpu=x86",

ci/builders/linux_unopt.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"os=Linux",
77
"cores=32"
88
],
9+
"gclient_variables": {
10+
"use_rbe": true
11+
},
912
"gn": [
1013
"--runtime-mode",
1114
"debug",
@@ -84,6 +87,9 @@
8487
"os=Linux"
8588
],
8689
"dependencies": [],
90+
"gclient_variables": {
91+
"use_rbe": true
92+
},
8793
"gn": [
8894
"--android",
8995
"--embedder-for-target",
@@ -112,6 +118,9 @@
112118
"version": "last_updated:2023-02-03T15:32:01-0800"
113119
}
114120
],
121+
"gclient_variables": {
122+
"use_rbe": true
123+
},
115124
"gn": [
116125
"--android",
117126
"--unoptimized",

ci/builders/mac_unopt.json

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@
1616
"mac_model=Macmini8,1"
1717
],
1818
"gclient_variables": {
19-
"download_android_deps": false
19+
"download_android_deps": false,
20+
"use_rbe": true
2021
},
2122
"gn": [
2223
"--runtime-mode",
2324
"debug",
2425
"--unoptimized",
2526
"--no-lto",
2627
"--prebuilt-dart-sdk",
27-
"--enable-impeller-3d"
28+
"--enable-impeller-3d",
29+
"--rbe",
30+
"--no-goma",
31+
"--xcode-symlinks"
2832
],
2933
"name": "host_debug_unopt",
3034
"ninja": {
@@ -75,14 +79,18 @@
7579
"cpu=x86"
7680
],
7781
"gclient_variables": {
78-
"download_android_deps": false
82+
"download_android_deps": false,
83+
"use_rbe": true
7984
},
8085
"gn": [
8186
"--ios",
8287
"--runtime-mode",
8388
"debug",
8489
"--simulator",
85-
"--no-lto"
90+
"--no-lto",
91+
"--rbe",
92+
"--no-goma",
93+
"--xcode-symlinks"
8694
],
8795
"name": "ios_debug_sim",
8896
"ninja": {
@@ -132,7 +140,8 @@
132140
"cpu=arm64"
133141
],
134142
"gclient_variables": {
135-
"download_android_deps": false
143+
"download_android_deps": false,
144+
"use_rbe": true
136145
},
137146
"gn": [
138147
"--runtime-mode",
@@ -142,7 +151,10 @@
142151
"--prebuilt-dart-sdk",
143152
"--force-mac-arm64",
144153
"--mac-cpu",
145-
"arm64"
154+
"arm64",
155+
"--rbe",
156+
"--no-goma",
157+
"--xcode-symlinks"
146158
],
147159
"name": "host_debug_unopt_arm64",
148160
"ninja": {
@@ -181,7 +193,8 @@
181193
"cpu=arm64"
182194
],
183195
"gclient_variables": {
184-
"download_android_deps": false
196+
"download_android_deps": false,
197+
"use_rbe": true
185198
},
186199
"gn": [
187200
"--ios",
@@ -191,7 +204,10 @@
191204
"--no-lto",
192205
"--force-mac-arm64",
193206
"--simulator-cpu",
194-
"arm64"
207+
"arm64",
208+
"--rbe",
209+
"--no-goma",
210+
"--xcode-symlinks"
195211
],
196212
"name": "ios_debug_sim_arm64",
197213
"ninja": {
@@ -251,7 +267,8 @@
251267
"cpu=arm64"
252268
],
253269
"gclient_variables": {
254-
"download_android_deps": false
270+
"download_android_deps": false,
271+
"use_rbe": true
255272
},
256273
"gn": [
257274
"--ios",
@@ -262,7 +279,10 @@
262279
"--force-mac-arm64",
263280
"--simulator-cpu",
264281
"arm64",
265-
"--darwin-extension-safe"
282+
"--darwin-extension-safe",
283+
"--rbe",
284+
"--no-goma",
285+
"--xcode-symlinks"
266286
],
267287
"name": "ios_debug_sim_arm64_extension_safe",
268288
"ninja": {

ci/builders/standalone/linux_benchmarks.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"os=Linux"
55
],
66
"gclient_variables": {
7-
"download_android_deps": false
7+
"download_android_deps": false,
8+
"use_rbe": true
89
},
910
"gn": [
1011
"--runtime-mode",

tools/gn

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ def buildtools_dir():
205205
host_cpu = get_host_cpu()
206206
if host_os == 'win':
207207
host_os = 'windows'
208-
if host_os == 'mac' and host_cpu == 'arm64':
209-
host_cpu = 'x64'
210208
return '%s-%s' % (host_os, host_cpu)
211209

212210

@@ -217,9 +215,10 @@ def setup_rbe(args):
217215
if not args.rbe:
218216
return rbe_gn_args
219217

220-
if get_host_os() not in ['linux']:
218+
if get_host_os() not in ['linux', 'mac']:
221219
print(
222-
'The --rbe flag has no effect. RBE is currently only supported on Linux.'
220+
'The --rbe flag has no effect. RBE is currently only supported on '
221+
'macOS and Linux.'
223222
)
224223
return rbe_gn_args
225224

@@ -239,7 +238,9 @@ def setup_rbe(args):
239238
)
240239
bootstrap_path = os.path.join(cipd_reclient_dir, 'bootstrap')
241240
reproxy_path = os.path.join(cipd_reclient_dir, 'reproxy')
242-
rbe_cfg_path = os.path.join(SRC_ROOT, 'build', 'rbe.cfg')
241+
rbe_cfg_path = os.path.join(
242+
SRC_ROOT, 'flutter', 'build', 'rbe', 'reclient.cfg'
243+
)
243244
bootstrap_cmd = [
244245
bootstrap_path,
245246
'--re_proxy=' + reproxy_path,
@@ -260,8 +261,20 @@ def setup_rbe(args):
260261
rbe_gn_args['rbe_dial_timeout'] = args.rbe_dial_timeout
261262
if args.rbe_platform:
262263
rbe_gn_args['rbe_platform'] = args.rbe_platform
263-
if args.rbe_dir:
264-
rbe_gn_args['rbe_dir'] = args.rbe_dir
264+
265+
rbe_gn_args['rbe_dir'] = os.path.join(
266+
SRC_ROOT, 'buildtools', buildtools_dir(), 'reclient'
267+
)
268+
269+
rbe_gn_args['rbe_cfg'] = os.path.join(
270+
SRC_ROOT, 'flutter', 'build', 'rbe',
271+
'rewrapper-' + buildtools_dir() + '.cfg'
272+
)
273+
274+
if sys.platform == 'darwin':
275+
if (not running_on_luci or args.xcode_symlinks or
276+
os.getenv('FLUTTER_GOMA_CREATE_XCODE_SYMLINKS', '0') == '1'):
277+
rbe_gn_args['create_xcode_symlinks'] = True
265278

266279
return rbe_gn_args
267280

@@ -285,8 +298,16 @@ def setup_goma(args):
285298
# care of starting and stopping the compiler proxy.
286299
running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
287300

301+
# The GOMA client has no arm64 binary, so run the x64 binary through
302+
# Rosetta.
303+
buildtools_platform = buildtools_dir()
304+
if buildtools_platform == 'mac-arm64':
305+
buildtools_platform = 'mac-x64'
306+
288307
# Prefer the goma fetched by gclient if it exists.
289-
cipd_goma_dir = os.path.join(SRC_ROOT, 'buildtools', buildtools_dir(), 'goma')
308+
cipd_goma_dir = os.path.join(
309+
SRC_ROOT, 'buildtools', buildtools_platform, 'goma'
310+
)
290311

291312
# Next, if GOMA_DIR is set, use that install.
292313
goma_dir = os.environ.get('GOMA_DIR')

0 commit comments

Comments
 (0)