Skip to content

Commit f914eae

Browse files
dbebawyreidbakercamsim99gmackall
authored
Ship gen_snapshot for linux-arm64 hosts targeting Android (flutter#182552)
## Summary Enable Android **profile** and **release** builds on ARM64 Linux hosts (AWS Graviton, GCP Tau T2A, self-hosted ARM64 runners, etc.), which currently fail because `gen_snapshot` is only shipped for `linux-x64` hosts. Supersedes flutter#182275 and flutter#182276 — combined into a single atomic commit per reviewer feedback. ### Engine changes - **`BUILD.gn`**: Make `gen_snapshot` and `analyze_snapshot` zip output names host-architecture-aware (`linux-arm64.zip` vs `linux-x64.zip`) using explicit `if (host_os == "linux" && host_cpu == "arm64")` branching, matching the existing pattern for mac/windows. - **`linux_arm64_android_aot_engine.json`** (new): CI builder config following the secondary builder pattern (matching `mac_android_aot_engine.json`). Only produces host-specific archives — shared artifacts (`artifacts.zip`, `symbols.zip`, embedding/abi jars) continue to be produced by the existing x64 Linux builder. - **`.ci.yaml`**: New builder entry with `bringup: true`, `os=Linux`, `cpu=arm64`. ### Framework changes - **`flutter_cache.dart`**: Convert `_linuxBinaryDirs` from a hardcoded `linux-x64` const list to a function parameterized by host architecture, using the existing `cache.getHostPlatformArchName()` pattern from `LinuxEngineArtifacts`. - **`artifacts.dart`**: Clean up stale TODO comment — replace with accurate explanation of why `darwin-arm64` is remapped to `darwin-x64` (universal binary). No Linux remapping needed since Linux ships native binaries per host architecture. - **Tests**: Add tests for both x64 and arm64 host artifact resolution in `cache_test.dart` and `artifacts_test.dart`, following the existing `LinuxEngineArtifacts` test pattern. ### Infrastructure notes - The builder is set to `bringup: true` to allow stabilization before becoming a blocking builder. - Requires ARM64 Linux machines in the LUCI swarming pool (`os=Linux` + `cpu=arm64`). - 8 build configurations: {arm, arm64, x64, riscv64} × {profile, release}. This matches the x64 Linux builder's target coverage. The macOS equivalent has 6 builds (no riscv64). - Uses RBE (`--rbe`) for remote compilation. Fixes flutter#75864 Fixes flutter#168980 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md ## Test plan ### Verified by PR CI (x64 hosts) - [x] `linux_android_aot_engine` (x64) passed — `BUILD.gn` change still produces `linux-x64.zip` correctly - [x] `mac_android_aot_engine` passed — `darwin-x64.zip` unaffected - [x] `windows_android_aot_engine` passed — `windows-x64.zip` unaffected - [x] `ci.yaml validation` passed — builder JSON and `.ci.yaml` entry are structurally valid - [x] Archive paths are unique across all builder configs (verified locally) - [x] Unit tests pass for `AndroidGenSnapshotArtifacts.getBinaryDirs()` returning `linux-x64` entries on x64 hosts and `linux-arm64` entries on arm64 hosts - [x] Unit tests pass for `getArtifactPath` resolving `gen_snapshot` to correct host-architecture path on both x64 and arm64 Linux ### Requires ARM64 Linux hardware (post-bringup) The new `linux_arm64_android_aot_engine` builder is `bringup: true` and does not run on PR checks. The `BUILD.gn` code path (`host_cpu == "arm64"`) is only exercised on ARM64 hosts. The following need to be validated once the builder runs on ARM64 infrastructure: - [ ] `gen_snapshot` compiles and links on ARM64 Linux - [ ] CI builder produces `linux-arm64.zip` archives for all Android target CPUs (arm, arm64, x64, riscv64) in both profile and release modes - [ ] `analyze_snapshot` produces `analyze-snapshot-linux-arm64.zip` for 64-bit targets - [ ] Artifacts download correctly on an ARM64 Linux host via `flutter precache` --------- Co-authored-by: Reid Baker <1063596+reidbaker@users.noreply.github.com> Co-authored-by: Camille Simon <43054281+camsim99@users.noreply.github.com> Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com>
1 parent 916ff67 commit f914eae

7 files changed

Lines changed: 484 additions & 15 deletions

File tree

engine/src/flutter/.ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,26 @@ targets:
302302
# at https://github.com/flutter/flutter/issues/152186.
303303
cores: "8"
304304

305+
- name: Linux linux_arm64_android_aot_engine
306+
bringup: true
307+
recipe: engine_v2/engine_v2
308+
timeout: 120
309+
properties:
310+
add_recipes_cq: "true"
311+
release_build: "true"
312+
config_name: linux_arm64_android_aot_engine
313+
# Do not remove(https://github.com/flutter/flutter/issues/144644)
314+
# Scheduler will fail to get the platform
315+
drone_dimensions:
316+
- os=Linux
317+
- cpu=arm64
318+
dimensions:
319+
# This is needed so that orchestrators that only spawn subbuilds are not
320+
# assigned to the large 32 core workers when doing release builds.
321+
# For more details see the issue
322+
# at https://github.com/flutter/flutter/issues/152186.
323+
cores: "8"
324+
305325
- name: Linux linux_android_aot_engine_ddm
306326
recipe: engine_v2/engine_v2
307327
timeout: 120
Lines changed: 357 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,357 @@
1+
{
2+
"_comment": [
3+
"The builds defined in this file should not contain tests, ",
4+
"and the file should not contain builds that are essentially tests. ",
5+
"The only builds in this file should be the builds necessary to produce ",
6+
"release artifacts. ",
7+
"Tests to run on linux hosts should go in one of the other linux_ build ",
8+
"definition files."
9+
],
10+
"luci_flags": {
11+
"upload_content_hash": true
12+
},
13+
"builds": [
14+
{
15+
"archives": [
16+
{
17+
"base_path": "out/ci/android_profile/zip_archives/",
18+
"type": "gcs",
19+
"include_paths": [
20+
"out/ci/android_profile/zip_archives/android-arm-profile/linux-arm64.zip"
21+
],
22+
"name": "ci/android_profile",
23+
"realm": "production"
24+
}
25+
],
26+
"drone_dimensions": [
27+
"device_type=none",
28+
"os=Linux",
29+
"cpu=arm64"
30+
],
31+
"gclient_variables": {
32+
"use_rbe": true
33+
},
34+
"gn": [
35+
"--target-dir",
36+
"ci/android_profile",
37+
"--runtime-mode",
38+
"profile",
39+
"--android",
40+
"--android-cpu",
41+
"arm",
42+
"--rbe",
43+
"--no-goma"
44+
],
45+
"name": "ci/android_profile",
46+
"description": "Produces profile mode artifacts to target 32-bit arm Android from an ARM64 Linux host.",
47+
"ninja": {
48+
"config": "ci/android_profile",
49+
"targets": [
50+
"flutter/lib/snapshot",
51+
"flutter/shell/platform/android:gen_snapshot"
52+
]
53+
}
54+
},
55+
{
56+
"archives": [
57+
{
58+
"base_path": "out/ci/android_release/zip_archives/",
59+
"type": "gcs",
60+
"include_paths": [
61+
"out/ci/android_release/zip_archives/android-arm-release/linux-arm64.zip"
62+
],
63+
"name": "ci/android_release",
64+
"realm": "production"
65+
}
66+
],
67+
"drone_dimensions": [
68+
"device_type=none",
69+
"os=Linux",
70+
"cpu=arm64"
71+
],
72+
"gclient_variables": {
73+
"use_rbe": true
74+
},
75+
"gn": [
76+
"--target-dir",
77+
"ci/android_release",
78+
"--runtime-mode",
79+
"release",
80+
"--android",
81+
"--android-cpu",
82+
"arm",
83+
"--rbe",
84+
"--no-goma"
85+
],
86+
"name": "ci/android_release",
87+
"description": "Produces release mode artifacts to target 32-bit arm Android from an ARM64 Linux host.",
88+
"ninja": {
89+
"config": "ci/android_release",
90+
"targets": [
91+
"flutter/lib/snapshot",
92+
"flutter/shell/platform/android:gen_snapshot"
93+
]
94+
}
95+
},
96+
{
97+
"archives": [
98+
{
99+
"base_path": "out/ci/android_profile_arm64/zip_archives/",
100+
"type": "gcs",
101+
"include_paths": [
102+
"out/ci/android_profile_arm64/zip_archives/android-arm64-profile/linux-arm64.zip",
103+
"out/ci/android_profile_arm64/zip_archives/android-arm64-profile/analyze-snapshot-linux-arm64.zip"
104+
],
105+
"name": "ci/android_profile_arm64",
106+
"realm": "production"
107+
}
108+
],
109+
"drone_dimensions": [
110+
"device_type=none",
111+
"os=Linux",
112+
"cpu=arm64"
113+
],
114+
"gclient_variables": {
115+
"use_rbe": true
116+
},
117+
"gn": [
118+
"--target-dir",
119+
"ci/android_profile_arm64",
120+
"--runtime-mode",
121+
"profile",
122+
"--android",
123+
"--android-cpu",
124+
"arm64",
125+
"--rbe",
126+
"--no-goma"
127+
],
128+
"name": "ci/android_profile_arm64",
129+
"description": "Produces profile mode artifacts to target 64-bit arm Android from an ARM64 Linux host.",
130+
"ninja": {
131+
"config": "ci/android_profile_arm64",
132+
"targets": [
133+
"flutter/lib/snapshot",
134+
"flutter/shell/platform/android:gen_snapshot",
135+
"flutter/shell/platform/android:analyze_snapshot"
136+
]
137+
}
138+
},
139+
{
140+
"archives": [
141+
{
142+
"base_path": "out/ci/android_release_arm64/zip_archives/",
143+
"type": "gcs",
144+
"include_paths": [
145+
"out/ci/android_release_arm64/zip_archives/android-arm64-release/linux-arm64.zip",
146+
"out/ci/android_release_arm64/zip_archives/android-arm64-release/analyze-snapshot-linux-arm64.zip"
147+
],
148+
"name": "ci/android_release_arm64",
149+
"realm": "production"
150+
}
151+
],
152+
"drone_dimensions": [
153+
"device_type=none",
154+
"os=Linux",
155+
"cpu=arm64"
156+
],
157+
"gclient_variables": {
158+
"use_rbe": true
159+
},
160+
"gn": [
161+
"--target-dir",
162+
"ci/android_release_arm64",
163+
"--runtime-mode",
164+
"release",
165+
"--android",
166+
"--android-cpu",
167+
"arm64",
168+
"--rbe",
169+
"--no-goma"
170+
],
171+
"name": "ci/android_release_arm64",
172+
"description": "Produces release mode artifacts to target 64-bit arm Android from an ARM64 Linux host.",
173+
"ninja": {
174+
"config": "ci/android_release_arm64",
175+
"targets": [
176+
"flutter/lib/snapshot",
177+
"flutter/shell/platform/android:gen_snapshot",
178+
"flutter/shell/platform/android:analyze_snapshot"
179+
]
180+
}
181+
},
182+
{
183+
"archives": [
184+
{
185+
"base_path": "out/ci/android_profile_x64/zip_archives/",
186+
"type": "gcs",
187+
"include_paths": [
188+
"out/ci/android_profile_x64/zip_archives/android-x64-profile/linux-arm64.zip",
189+
"out/ci/android_profile_x64/zip_archives/android-x64-profile/analyze-snapshot-linux-arm64.zip"
190+
],
191+
"name": "ci/android_profile_x64",
192+
"realm": "production"
193+
}
194+
],
195+
"drone_dimensions": [
196+
"device_type=none",
197+
"os=Linux",
198+
"cpu=arm64"
199+
],
200+
"gclient_variables": {
201+
"use_rbe": true
202+
},
203+
"gn": [
204+
"--target-dir",
205+
"ci/android_profile_x64",
206+
"--runtime-mode",
207+
"profile",
208+
"--android",
209+
"--android-cpu",
210+
"x64",
211+
"--rbe",
212+
"--no-goma"
213+
],
214+
"name": "ci/android_profile_x64",
215+
"description": "Produces profile mode artifacts to target x64 Android from an ARM64 Linux host.",
216+
"ninja": {
217+
"config": "ci/android_profile_x64",
218+
"targets": [
219+
"flutter/lib/snapshot",
220+
"flutter/shell/platform/android:gen_snapshot",
221+
"flutter/shell/platform/android:analyze_snapshot"
222+
]
223+
}
224+
},
225+
{
226+
"archives": [
227+
{
228+
"base_path": "out/ci/android_release_x64/zip_archives/",
229+
"type": "gcs",
230+
"include_paths": [
231+
"out/ci/android_release_x64/zip_archives/android-x64-release/linux-arm64.zip",
232+
"out/ci/android_release_x64/zip_archives/android-x64-release/analyze-snapshot-linux-arm64.zip"
233+
],
234+
"name": "ci/android_release_x64",
235+
"realm": "production"
236+
}
237+
],
238+
"drone_dimensions": [
239+
"device_type=none",
240+
"os=Linux",
241+
"cpu=arm64"
242+
],
243+
"gclient_variables": {
244+
"use_rbe": true
245+
},
246+
"gn": [
247+
"--target-dir",
248+
"ci/android_release_x64",
249+
"--runtime-mode",
250+
"release",
251+
"--android",
252+
"--android-cpu",
253+
"x64",
254+
"--rbe",
255+
"--no-goma"
256+
],
257+
"name": "ci/android_release_x64",
258+
"description": "Produces release mode artifacts to target x64 Android from an ARM64 Linux host.",
259+
"ninja": {
260+
"config": "ci/android_release_x64",
261+
"targets": [
262+
"flutter/lib/snapshot",
263+
"flutter/shell/platform/android:gen_snapshot",
264+
"flutter/shell/platform/android:analyze_snapshot"
265+
]
266+
}
267+
},
268+
{
269+
"archives": [
270+
{
271+
"base_path": "out/ci/android_profile_riscv64/zip_archives/",
272+
"type": "gcs",
273+
"include_paths": [
274+
"out/ci/android_profile_riscv64/zip_archives/android-riscv64-profile/linux-arm64.zip",
275+
"out/ci/android_profile_riscv64/zip_archives/android-riscv64-profile/analyze-snapshot-linux-arm64.zip"
276+
],
277+
"name": "ci/android_profile_riscv64",
278+
"realm": "production"
279+
}
280+
],
281+
"drone_dimensions": [
282+
"device_type=none",
283+
"os=Linux",
284+
"cpu=arm64"
285+
],
286+
"gclient_variables": {
287+
"use_rbe": true
288+
},
289+
"gn": [
290+
"--target-dir",
291+
"ci/android_profile_riscv64",
292+
"--runtime-mode",
293+
"profile",
294+
"--android",
295+
"--android-cpu",
296+
"riscv64",
297+
"--rbe",
298+
"--no-goma"
299+
],
300+
"name": "ci/android_profile_riscv64",
301+
"description": "Produces profile mode artifacts to target riscv64 Android from an ARM64 Linux host.",
302+
"ninja": {
303+
"config": "ci/android_profile_riscv64",
304+
"targets": [
305+
"flutter/lib/snapshot",
306+
"flutter/shell/platform/android:gen_snapshot",
307+
"flutter/shell/platform/android:analyze_snapshot"
308+
]
309+
}
310+
},
311+
{
312+
"archives": [
313+
{
314+
"base_path": "out/ci/android_release_riscv64/zip_archives/",
315+
"type": "gcs",
316+
"include_paths": [
317+
"out/ci/android_release_riscv64/zip_archives/android-riscv64-release/linux-arm64.zip",
318+
"out/ci/android_release_riscv64/zip_archives/android-riscv64-release/analyze-snapshot-linux-arm64.zip"
319+
],
320+
"name": "ci/android_release_riscv64",
321+
"realm": "production"
322+
}
323+
],
324+
"drone_dimensions": [
325+
"device_type=none",
326+
"os=Linux",
327+
"cpu=arm64"
328+
],
329+
"gclient_variables": {
330+
"use_rbe": true
331+
},
332+
"gn": [
333+
"--target-dir",
334+
"ci/android_release_riscv64",
335+
"--runtime-mode",
336+
"release",
337+
"--android",
338+
"--android-cpu",
339+
"riscv64",
340+
"--rbe",
341+
"--no-goma"
342+
],
343+
"name": "ci/android_release_riscv64",
344+
"description": "Produces release mode artifacts to target riscv64 Android from an ARM64 Linux host.",
345+
"ninja": {
346+
"config": "ci/android_release_riscv64",
347+
"targets": [
348+
"flutter/lib/snapshot",
349+
"flutter/shell/platform/android:gen_snapshot",
350+
"flutter/shell/platform/android:analyze_snapshot"
351+
]
352+
}
353+
}
354+
],
355+
"generators": {},
356+
"archives": []
357+
}

0 commit comments

Comments
 (0)