Skip to content

Support linux-arm64 host for Android gen_snapshot artifact download#182276

Closed
dbebawy wants to merge 1 commit into
flutter:masterfrom
dbebawy:framework-linux-arm64-gen-snapshot
Closed

Support linux-arm64 host for Android gen_snapshot artifact download#182276
dbebawy wants to merge 1 commit into
flutter:masterfrom
dbebawy:framework-linux-arm64-gen-snapshot

Conversation

@dbebawy

@dbebawy dbebawy commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert _linuxBinaryDirs from a hardcoded linux-x64 const list to a function parameterized by host architecture, following the existing LinuxEngineArtifacts pattern using cache.getHostPlatformArchName()
  • Clean up stale TODO comment in artifacts.dart
  • Add tests for both x64 and arm64 host artifact resolution

On ARM64 Linux hosts, flutter build apk --release fails because the tool tries to find gen_snapshot at linux-arm64/gen_snapshot but only linux-x64 artifacts are downloaded. This change makes the artifact download host-architecture-aware.

Depends on #182275 (engine-side changes that produce linux-arm64.zip archives).

Related #75864
Related #168980

Test plan

  • AndroidGenSnapshotArtifacts.getBinaryDirs() returns linux-x64 entries on x64 hosts
  • AndroidGenSnapshotArtifacts.getBinaryDirs() returns linux-arm64 entries on arm64 hosts
  • getArtifactPath resolves gen_snapshot to linux-x64/gen_snapshot on x64 Linux
  • getArtifactPath resolves gen_snapshot to linux-arm64/gen_snapshot on arm64 Linux
  • Existing macOS and Windows artifact resolution is unaffected

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
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 12, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +169 to +213
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',
),
);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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',
            ),
          );
        });
      }
    });

Comment on lines +776 to +806
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'],
]);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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'],
        ]);
      });
    }
  });

@jmagman

jmagman commented Feb 17, 2026

Copy link
Copy Markdown
Member

Depends on #182275 (engine-side changes that produce linux-arm64.zip archives).

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.

@dbebawy

dbebawy commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #182552 — combined engine and framework changes into a single atomic commit per @jmagman's feedback.

@dbebawy

dbebawy commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

@jmagman Thanks for the heads up. Combined both into a single atomic commit in #182552.

@dbebawy dbebawy closed this Feb 18, 2026
pull Bot pushed a commit to TheRakeshPurohit/flutter that referenced this pull request Apr 29, 2026
…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>
MarlonJD pushed a commit to MarlonJD/flutter that referenced this pull request May 20, 2026
…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>
eyebrowsoffire added a commit to eyebrowsoffire/flutter that referenced this pull request May 20, 2026
…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>
auto-submit Bot pushed a commit that referenced this pull request May 21, 2026
…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.
matthewhendrix pushed a commit to matthewhendrix/flutter that referenced this pull request May 23, 2026
…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>
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants