Ship gen_snapshot for linux-arm64 hosts targeting Android#182275
Ship gen_snapshot for linux-arm64 hosts targeting Android#182275dbebawy wants to merge 1 commit into
Conversation
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.). 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 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. Fixes flutter#75864 Fixes flutter#168980
|
Companion framework PR: #182276 |
There was a problem hiding this comment.
Code Review
This pull request enables building Android profile and release artifacts on ARM64 Linux hosts by adding a new CI builder and updating the build scripts. The changes include:
- A new CI target
Linux linux_arm64_android_aot_enginein.ci.yaml. - A new builder configuration file
linux_arm64_android_aot_engine.jsonthat defines the builds for producinggen_snapshotandanalyze_snapshotfor various Android targets from alinux-arm64host. - Updates to
BUILD.gnto correctly name the output archives forlinux-arm64hosts.
The changes are well-structured and follow existing patterns in the repository. I have one suggestion to improve maintainability by reducing code duplication in BUILD.gn.
| if (host_os == "linux" && host_cpu == "arm64") { | ||
| output = "$android_zip_archive_dir/linux-arm64.zip" | ||
| } else if (host_os == "linux") { | ||
| output = "$android_zip_archive_dir/linux-x64.zip" |
There was a problem hiding this comment.
To improve maintainability and reduce code duplication, consider defining a variable for the host platform string and reusing it. This same logic for determining the output path based on host_os and host_cpu is duplicated in the analyze_snapshot target around line 827.
You could define a variable at a shared scope, for example:
if (host_os == "linux") {
if (host_cpu == "arm64") {
_host_platform_string = "linux-arm64"
} else {
_host_platform_string = "linux-x64"
}
} else if (host_os == "mac") {
_host_platform_string = "darwin-x64"
} else if (host_os == "win") {
_host_platform_string = "windows-x64"
}Then you can use it like this in gen_snapshot:
output = "$android_zip_archive_dir/${_host_platform_string}.zip"
And in analyze_snapshot:
output = "$android_zip_archive_dir/analyze-snapshot-${_host_platform_string}.zip"
This would make the code more DRY (Don't Repeat Yourself) and easier to maintain if more host platforms are added in the future.
References
- The repository style guide recommends optimizing for readability and avoiding duplicating state (lines 29-30). The GN style guide also encourages using variables to avoid duplicating values. This logic for determining the host platform string is repeated in two places and can be extracted into a variable to improve maintainability. (link)
|
Thank you for your contribution! I am trying to understand what level of maintenance burden this will be to maintain and if there are other aspects to making this work well that the flutter contributor team needs to do at the same time. Let me talk with some of my coworkers. I will add our thoughts here after we have talked. |
| # at https://github.com/flutter/flutter/issues/152186. | ||
| cores: "8" | ||
|
|
||
| - name: Linux linux_arm64_android_aot_engine |
There was a problem hiding this comment.
new builders must be bringup: true until they are stable.
There was a problem hiding this comment.
Done — added bringup: true in the combined PR #182552. Thanks for the catch.
|
@reidbaker Thanks for looking into this. Happy to answer any questions about maintenance burden. The ARM64 builder follows the same secondary builder pattern as the existing macOS builder ( |
|
Correcting my earlier comment — wanted to give a more accurate picture of the maintenance burden: Infrastructure:
Scope:
Ongoing maintenance:
Happy to discuss further or adjust scope (e.g., dropping riscv64 to match the macOS builder's 6-build pattern if that reduces concern). Combined PR: #182552 |
|
@dbebawy did you mean to close this pr? |
|
@reidbaker Yes — per @jmagman's feedback on #182276 that engine and framework changes should be in a single atomic commit (since the monorepo merge in Dec 2024), I combined both PRs into #182552. That PR also incorporates @jtmcdole's feedback to add |
…2552) ## 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>
…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>
…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>
…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>
Summary
gen_snapshotandanalyze_snapshotzip output names inBUILD.gnhost-architecture-aware (linux-arm64.zipvslinux-x64.zip)linux_arm64_android_aot_engine.jsonCI builder config following the secondary builder pattern (matchingmac_android_aot_engine.json).ci.yamlentry for the new ARM64 Linux builderThe ARM64 builder only produces host-specific archives (
linux-arm64.zipandanalyze-snapshot-linux-arm64.zip). Shared artifacts (artifacts.zip,symbols.zip, embedding/abi jars) continue to be produced by the existing x64 Linux builder.This enables Android profile and release builds on ARM64 Linux machines (AWS Graviton, GCP Tau T2A, self-hosted ARM64 runners, etc.), which currently fail because
gen_snapshotis only shipped forlinux-x64hosts.Fixes #75864
Fixes #168980
Test plan
linux-arm64.ziparchives for all Android target CPUs (arm, arm64, x64, riscv64) in both profile and release modescheck.dartlogic)linux-x64builds are unaffected —BUILD.gnchange still produceslinux-x64.zipon x64 hosts