Support linux-arm64 host for Android gen_snapshot artifact download#182276
Support linux-arm64 host for Android gen_snapshot artifact download#182276dbebawy wants to merge 1 commit into
Conversation
Make AndroidGenSnapshotArtifacts download the correct gen_snapshot archives based on host architecture, using the existing cache.getHostPlatformArchName() pattern from LinuxEngineArtifacts. Changes: - Convert _linuxBinaryDirs from a const list to a function parameterized by host architecture - Call with cache.getHostPlatformArchName() in getBinaryDirs() - Clean up stale TODO comment in artifacts.dart - Add tests for both x64 and arm64 host artifact resolution Depends on engine-side changes that ship linux-arm64.zip archives. Related flutter#75864 Related flutter#168980
There was a problem hiding this comment.
Code Review
This pull request correctly adds support for linux-arm64 hosts for Android gen_snapshot artifact downloads by parameterizing the artifact paths based on the host architecture. No security vulnerabilities were identified during the audit, as the data flow for architecture-specific path construction is well-controlled, mitigating risks of injection or path traversal. However, there are suggestions to refactor the new tests to reduce code duplication and improve long-term maintainability.
| testWithoutContext('getArtifactPath resolves gen_snapshot to linux-x64 on x64 Linux host', () { | ||
| expect( | ||
| artifacts.getArtifactPath( | ||
| Artifact.genSnapshot, | ||
| platform: TargetPlatform.android_arm64, | ||
| mode: BuildMode.release, | ||
| ), | ||
| fileSystem.path.join( | ||
| 'root', | ||
| 'bin', | ||
| 'cache', | ||
| 'artifacts', | ||
| 'engine', | ||
| 'android-arm64-release', | ||
| 'linux-x64', | ||
| 'gen_snapshot', | ||
| ), | ||
| ); | ||
| }); | ||
|
|
||
| testWithoutContext('getArtifactPath resolves gen_snapshot to linux-arm64 on arm64 Linux host', () { | ||
| final arm64Artifacts = CachedArtifacts( | ||
| fileSystem: fileSystem, | ||
| cache: cache, | ||
| platform: platform, | ||
| operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64), | ||
| ); | ||
| expect( | ||
| arm64Artifacts.getArtifactPath( | ||
| Artifact.genSnapshot, | ||
| platform: TargetPlatform.android_arm64, | ||
| mode: BuildMode.release, | ||
| ), | ||
| fileSystem.path.join( | ||
| 'root', | ||
| 'bin', | ||
| 'cache', | ||
| 'artifacts', | ||
| 'engine', | ||
| 'android-arm64-release', | ||
| 'linux-arm64', | ||
| 'gen_snapshot', | ||
| ), | ||
| ); | ||
| }); |
There was a problem hiding this comment.
These two tests are very similar and can be combined to reduce duplication and improve maintainability. Consider using a group and a loop to run the test for both x64 and arm64 architectures. This would make it easier to add more architectures in the future.
group('getArtifactPath for gen_snapshot on Linux', () {
for (final hostPlatform in [HostPlatform.linux_x64, HostPlatform.linux_arm64]) {
final String arch = hostPlatform == HostPlatform.linux_x64 ? 'x64' : 'arm64';
testWithoutContext('resolves to linux-$arch on $arch Linux host', () {
final testArtifacts = hostPlatform == HostPlatform.linux_x64
? artifacts
: CachedArtifacts(
fileSystem: fileSystem,
cache: cache,
platform: platform,
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: hostPlatform),
);
expect(
testArtifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
fileSystem.path.join(
'root',
'bin',
'cache',
'artifacts',
'engine',
'android-arm64-release',
'linux-$arch',
'gen_snapshot',
),
);
});
}
});| testWithoutContext('Android gen_snapshot artifacts on x64 linux host include linux-x64 archives', () { | ||
| fakeProcessManager.addCommand(unameCommandForX64); | ||
|
|
||
| final Cache cache = createCache(FakePlatform()); | ||
| final artifacts = AndroidGenSnapshotArtifacts(cache, platform: FakePlatform()); | ||
|
|
||
| expect(artifacts.getBinaryDirs(), <List<String>>[ | ||
| <String>['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'], | ||
| <String>['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'], | ||
| <String>['android-arm64-profile/linux-x64', 'android-arm64-profile/linux-x64.zip'], | ||
| <String>['android-arm64-release/linux-x64', 'android-arm64-release/linux-x64.zip'], | ||
| <String>['android-x64-profile/linux-x64', 'android-x64-profile/linux-x64.zip'], | ||
| <String>['android-x64-release/linux-x64', 'android-x64-release/linux-x64.zip'], | ||
| ]); | ||
| }); | ||
|
|
||
| testWithoutContext('Android gen_snapshot artifacts on arm64 linux host include linux-arm64 archives', () { | ||
| fakeProcessManager.addCommand(unameCommandForArm64); | ||
|
|
||
| final Cache cache = createCache(FakePlatform()); | ||
| final artifacts = AndroidGenSnapshotArtifacts(cache, platform: FakePlatform()); | ||
|
|
||
| expect(artifacts.getBinaryDirs(), <List<String>>[ | ||
| <String>['android-arm-profile/linux-arm64', 'android-arm-profile/linux-arm64.zip'], | ||
| <String>['android-arm-release/linux-arm64', 'android-arm-release/linux-arm64.zip'], | ||
| <String>['android-arm64-profile/linux-arm64', 'android-arm64-profile/linux-arm64.zip'], | ||
| <String>['android-arm64-release/linux-arm64', 'android-arm64-release/linux-arm64.zip'], | ||
| <String>['android-x64-profile/linux-arm64', 'android-x64-profile/linux-arm64.zip'], | ||
| <String>['android-x64-release/linux-arm64', 'android-x64-release/linux-arm64.zip'], | ||
| ]); | ||
| }); |
There was a problem hiding this comment.
These two tests are nearly identical. To improve maintainability and reduce code duplication, you could refactor them into a single parameterized test, perhaps using a group and a loop over the different architectures.
group('Android gen_snapshot artifacts on Linux host', () {
for (final ({String arch, FakeCommand command}) testCase in [
(arch: 'x64', command: unameCommandForX64),
(arch: 'arm64', command: unameCommandForArm64),
]) {
testWithoutContext('include linux-${testCase.arch} archives on ${testCase.arch} linux host', () {
fakeProcessManager.addCommand(testCase.command);
final Cache cache = createCache(FakePlatform());
final artifacts = AndroidGenSnapshotArtifacts(cache, platform: FakePlatform());
expect(artifacts.getBinaryDirs(), <List<String>>[
<String>['android-arm-profile/linux-${testCase.arch}', 'android-arm-profile/linux-${testCase.arch}.zip'],
<String>['android-arm-release/linux-${testCase.arch}', 'android-arm-release/linux-${testCase.arch}.zip'],
<String>['android-arm64-profile/linux-${testCase.arch}', 'android-arm64-profile/linux-${testCase.arch}.zip'],
<String>['android-arm64-release/linux-${testCase.arch}', 'android-arm64-release/linux-${testCase.arch}.zip'],
<String>['android-x64-profile/linux-${testCase.arch}', 'android-x64-profile/linux-${testCase.arch}.zip'],
<String>['android-x64-release/linux-${testCase.arch}', 'android-x64-release/linux-${testCase.arch}.zip'],
]);
});
}
});
Drive-by comment: in case you split this up based on prior patterns, the Flutter engine and framework were merged into the same repo in December 2024, so you can atomically (and should, unless you have good reason) make changes to both in the same commit. |
…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
_linuxBinaryDirsfrom a hardcodedlinux-x64const list to a function parameterized by host architecture, following the existingLinuxEngineArtifactspattern usingcache.getHostPlatformArchName()artifacts.dartOn ARM64 Linux hosts,
flutter build apk --releasefails because the tool tries to findgen_snapshotatlinux-arm64/gen_snapshotbut onlylinux-x64artifacts are downloaded. This change makes the artifact download host-architecture-aware.Depends on #182275 (engine-side changes that produce
linux-arm64.ziparchives).Related #75864
Related #168980
Test plan
AndroidGenSnapshotArtifacts.getBinaryDirs()returnslinux-x64entries on x64 hostsAndroidGenSnapshotArtifacts.getBinaryDirs()returnslinux-arm64entries on arm64 hostsgetArtifactPathresolvesgen_snapshottolinux-x64/gen_snapshoton x64 LinuxgetArtifactPathresolvesgen_snapshottolinux-arm64/gen_snapshoton arm64 Linux