Ship gen_snapshot for linux-arm64 hosts targeting Android#182552
Conversation
There was a problem hiding this comment.
Code Review
This pull request enables building Android profile and release artifacts on ARM64 Linux hosts by making gen_snapshot and analyze_snapshot host-architecture-aware. A new CI builder for linux-arm64 is added, along with corresponding build configurations. The Flutter tool's artifact handling for Android gen_snapshot is updated to correctly resolve paths based on the host architecture on Linux. The changes are well-tested with new unit tests for artifact resolution and cache behavior. The code is clean and the changes are logical.
2980c04 to
c4bd392
Compare
|
Tagging reviewers from the original PRs (#182275 and #182276) which were combined here per feedback: @jtmcdole — Added |
f216e41 to
c907882
Compare
|
This pr need approval from someone on infra and from someone on the engine team before landing. @jtmcdole is both but may delegate to others for one or both of those roles. |
c907882 to
2bfbb64
Compare
Build gen_snapshot and analyze_snapshot for ARM64 Linux hosts targeting Android, enabling profile and release builds on ARM64 Linux machines (AWS Graviton, GCP Tau T2A, etc.). Engine changes: - Make gen_snapshot and analyze_snapshot zip output names in BUILD.gn host-architecture-aware (linux-arm64.zip vs linux-x64.zip) - Add linux_arm64_android_aot_engine.json CI builder config following the secondary builder pattern (matching mac_android_aot_engine.json) - Add .ci.yaml entry for the new ARM64 Linux builder (bringup: true) The ARM64 builder only produces host-specific archives (linux-arm64.zip and analyze-snapshot-linux-arm64.zip). Shared artifacts (artifacts.zip, symbols.zip, embedding/abi jars) continue to be produced by the existing x64 Linux builder. Framework changes: - Convert _linuxBinaryDirs from a const list to a function parameterized by host architecture, using the existing cache.getHostPlatformArchName() pattern from LinuxEngineArtifacts - Clean up stale TODO comment in artifacts.dart - Add tests for both x64 and arm64 host artifact resolution Fixes flutter#75864 Fixes flutter#168980
- Replace getCurrentHostPlatform() with _operatingSystemUtils.hostPlatform in _getAndroidArtifactPath to use constructor-injected dependency instead of zone-injected global, matching the pattern used elsewhere in CachedArtifacts (lines 500, 538) - Apply dart format to test files with long test names
2bfbb64 to
84c7cd8
Compare
|
Hi @jtmcdole @reidbaker — it looks like the LUCI CI suite isn't triggering on this PR. Could someone approve the pipeline or add the |
|
Validated the framework changes on Framework path — works as intended
Engine artifacts — not yet on GCS
Context: downstream Flutter app, currently pinning CI runners to |
|
A reason for requesting a revert of flutter/flutter/182552 could not be found or the reason was not properly formatted. Begin a comment with 'Reason for revert:' to tell the bot why this issue is being reverted. |
|
Reason for revert: We do not have any bots capable of servicing this builder, and it is breaking our releases as well as |
|
Successfully created revert PR: #186693 |
…lutter#186693) Reverts: [Ship gen_snapshot for linux-arm64 hosts targeting Android](flutter#182552) Initiated by: @eyebrowsoffire Reason for reverting: We do not have any bots capable of servicing this builder, and it is breaking our releases as well as `flutter precache --all` Original PR Author: @dbebawy Reviewed By: @reidbaker The original PR description is provided below: ## 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: Jackson Gardner <jacksongardner@google.com>
|
We need to see if we can bypass the linux_arm64 tooling requirement since we don't have official binaries in cipd. |
…lutter#186693) Reverts: [Ship gen_snapshot for linux-arm64 hosts targeting Android](flutter#182552) Initiated by: @eyebrowsoffire Reason for reverting: We do not have any bots capable of servicing this builder, and it is breaking our releases as well as `flutter precache --all` Original PR Author: @dbebawy Reviewed By: @reidbaker The original PR description is provided below: ## 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: Jackson Gardner <jacksongardner@google.com>
…roid" (#186818) This is a cherry-pick of this revert, which is needed because the change that was reverted caused a breakage in our release build. Reverts: [Ship gen_snapshot for linux-arm64 hosts targeting Android](#182552) Initiated by: @eyebrowsoffire Reason for reverting: We do not have any bots capable of servicing this builder, and it is breaking our releases as well as `flutter precache --all` Original PR Author: @dbebawy Reviewed By: @reidbaker The original PR description is provided below: ## 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 #182275 and #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 #75864 Fixes #168980 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/ 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) ### 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: --------- <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> *Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.* *List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.* *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.
…lutter#186693) Reverts: [Ship gen_snapshot for linux-arm64 hosts targeting Android](flutter#182552) Initiated by: @eyebrowsoffire Reason for reverting: We do not have any bots capable of servicing this builder, and it is breaking our releases as well as `flutter precache --all` Original PR Author: @dbebawy Reviewed By: @reidbaker The original PR description is provided below: ## 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: Jackson Gardner <jacksongardner@google.com>
…s on linux-arm64 (flutter#186917) flutter#182552 added support in the Flutter tools for using a version of gen_snapshot that runs on linux-arm64 hosts and targets Android devices. However, the engine build infrastructure is not currently set up to build this kind of gen_snapshot binary. This PR contains changes needed to build engine artifacts on linux-arm64 machines. With this PR a linux-arm64 build environment can: * run "gclient sync" * build targets like zip_archives/android-arm64-profile/linux-arm64.zip that were added in flutter#182552
|
Reland PR is open: #187591. Runtime smoke on real arm64 Linux included. Framework follow-up will land after artifacts ship to GCS. Reland update for anyone following this thread. @jtmcdole — taking the direction you laid out on 2026-05-20 (bypass the linux_arm64 tooling requirement since we don't have official binaries in cipd). The reland uses the existing linux-x64 bot pool and cross-compiles the host Validated empirically on native linux-x64 hardware, twice:
Output binary on both runs: Engine change is a ~6-file diff (+20/−7) introducing a The new Framework changes from the original PR are intentionally held back until the builder has produced |
Relands flutter#182552, reverted in flutter#186693 because the linux-arm64 builder introduced in that PR had no bots in the LUCI pool and `flutter precache --all` started 404'ing on missing `linux-arm64.zip` artifacts after the beta cut. This reland takes the direction @jtmcdole laid out on the original PR on 2026-05-20 ("bypass the linux_arm64 tooling requirement since we don't have official binaries in cipd"): the new `linux_arm64_android_aot_engine` builder runs on the **existing linux-x64 bot pool** and cross-compiles the host `gen_snapshot` binary to linux-arm64. No new arm64 bots, no dependency on the `flutter/android/sdk/all` CIPD package getting a linux-arm64 platform build. Engine code changes (+20 / -7 across 6 files): - DEPS: drop `host_cpu == "arm64"` clause on the linux-arm64 clang CIPD download so x64 builders also fetch it (the clang binary is never executed; cross-compile happens via `--target=aarch64-linux-gnu` using the x64 clang). - engine/src/build/config/BUILDCONFIG.gn: introduce `host_clang_cpu`, a new gn arg defaulting to `host_cpu`. Represents the CPU of build-time tools that run on the builder, distinct from `host_cpu` (the CPU the produced host binary runs on). No-op for native builds. - engine/src/build/toolchain/linux/BUILD.gn: clang binary path is now keyed on `host_clang_cpu` instead of `host_cpu`, so the executable used during the build stays the x64 clang even when producing arm64 output. - engine/src/flutter/common/config.gni: the prebuilt Dart SDK path for build-time tooling (frontend server, kernel-to-AOT-snapshot) follows `host_clang_cpu`, so it resolves to the x64 dart-sdk on the builder. - engine/src/flutter/shell/platform/android/BUILD.gn: zip names use `linux-\$host_cpu.zip` interpolation (matching what `flutter precache` looks for on arm64 hosts), and the gen_snapshot zip's deps now mirror what analyze_snapshot already does -- depend only on the host binary instead of `generate_snapshot_bins`, which runs gen_snapshot during the build (impossible when cross-compiled to aarch64). - engine/src/flutter/tools/gn: add a `--host-cpu` flag, apply it in both `is_host_build()` and the cross-target (`else`) branches (the original PR only set host_cpu in the `is_host_build` branch, which is why `--host-cpu=arm64 --android` silently produced x86_64), and set `host_clang_cpu` to the build-machine CPU only when cross-compiling. Plus CI plumbing for this reland: - engine/src/flutter/ci/builders/linux_arm64_android_aot_engine.json: new builder config based on the reverted PR's version with four deltas: drone_dimensions drop `cpu=arm64` (runs on x64 pool), gn args add `--host-cpu arm64`, gclient_variables add `download_android_deps: false` and `download_jdk: false`, and ninja targets are the explicit `zip_archives/.../linux-arm64.zip` paths rather than the `flutter/shell/platform/android:gen_snapshot` umbrella target. - engine/src/flutter/.ci.yaml: matching builder entry, same shape as the reverted PR's entry, `cpu=arm64` removed from drone_dimensions, `bringup: true`. The framework changes from the reverted PR (flutter_tools cache / artifact-path resolution) are intentionally NOT included here. They land in a follow-up PR once the new builder has produced `linux-arm64.zip` to GCS for at least one release. That sequencing is the direct fix for the `flutter precache --all` 404 that triggered the original revert: artifacts before manifest. Empirically validated on native linux-x64 hardware (Debian 12 Docker, real Intel x86_64, no QEMU): - Original validation 2026-05-29 against `c7f49fe0` produced `linux-arm64.zip` (1.77 MB) and `analyze-snapshot-linux-arm64.zip` (2.8 MB). - Fresh re-validation 2026-06-04 against `14c05c42` (then-current `main`): patches apply cleanly, `ninja clang_arm64/gen_snapshot` exits 0 in 6m37s `-j8`, output binary is ELF aarch64 PIE, glibc-linked, not Android bionic. Binary SHA256: 898413a122ef33d42044fb0a2aa3259803f051ef9063b4d8ddd5e4eb7fa49cd0. Runtime smoke test on real arm64 hardware (Graviton / arm64 VM / etc.) is still owed before flipping `bringup: true` to false. QEMU user-mode segfaults on gen_snapshot -- a known qemu limitation with executable mmap / TLS-heavy runtimes, not a binary defect. Fixes flutter#75864 Fixes flutter#168980
…lutter#186693) Reverts: [Ship gen_snapshot for linux-arm64 hosts targeting Android](flutter#182552) Initiated by: @eyebrowsoffire Reason for reverting: We do not have any bots capable of servicing this builder, and it is breaking our releases as well as `flutter precache --all` Original PR Author: @dbebawy Reviewed By: @reidbaker The original PR description is provided below: ## 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: Jackson Gardner <jacksongardner@google.com>
…s on linux-arm64 (flutter#186917) flutter#182552 added support in the Flutter tools for using a version of gen_snapshot that runs on linux-arm64 hosts and targets Android devices. However, the engine build infrastructure is not currently set up to build this kind of gen_snapshot binary. This PR contains changes needed to build engine artifacts on linux-arm64 machines. With this PR a linux-arm64 build environment can: * run "gclient sync" * build targets like zip_archives/android-arm64-profile/linux-arm64.zip that were added in 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_snapshotis only shipped forlinux-x64hosts.Supersedes #182275 and #182276 — combined into a single atomic commit per reviewer feedback.
Engine changes
BUILD.gn: Makegen_snapshotandanalyze_snapshotzip output names host-architecture-aware (linux-arm64.zipvslinux-x64.zip) using explicitif (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 (matchingmac_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 withbringup: true,os=Linux,cpu=arm64.Framework changes
flutter_cache.dart: Convert_linuxBinaryDirsfrom a hardcodedlinux-x64const list to a function parameterized by host architecture, using the existingcache.getHostPlatformArchName()pattern fromLinuxEngineArtifacts.artifacts.dart: Clean up stale TODO comment — replace with accurate explanation of whydarwin-arm64is remapped todarwin-x64(universal binary). No Linux remapping needed since Linux ships native binaries per host architecture.cache_test.dartandartifacts_test.dart, following the existingLinuxEngineArtifactstest pattern.Infrastructure notes
bringup: trueto allow stabilization before becoming a blocking builder.os=Linux+cpu=arm64).--rbe) for remote compilation.Fixes #75864
Fixes #168980
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Test plan
Verified by PR CI (x64 hosts)
linux_android_aot_engine(x64) passed —BUILD.gnchange still produceslinux-x64.zipcorrectlymac_android_aot_enginepassed —darwin-x64.zipunaffectedwindows_android_aot_enginepassed —windows-x64.zipunaffectedci.yaml validationpassed — builder JSON and.ci.yamlentry are structurally validAndroidGenSnapshotArtifacts.getBinaryDirs()returninglinux-x64entries on x64 hosts andlinux-arm64entries on arm64 hostsgetArtifactPathresolvinggen_snapshotto correct host-architecture path on both x64 and arm64 LinuxRequires ARM64 Linux hardware (post-bringup)
The new
linux_arm64_android_aot_enginebuilder isbringup: trueand does not run on PR checks. TheBUILD.gncode path (host_cpu == "arm64") is only exercised on ARM64 hosts. The following need to be validated once the builder runs on ARM64 infrastructure:gen_snapshotcompiles and links on ARM64 Linuxlinux-arm64.ziparchives for all Android target CPUs (arm, arm64, x64, riscv64) in both profile and release modesanalyze_snapshotproducesanalyze-snapshot-linux-arm64.zipfor 64-bit targetsflutter precache