Skip to content

[flutter_tools] Migrate build targets, tester devices, application packages, and tool utilities away from globals - #193647

Merged
auto-submit[bot] merged 13 commits into
flutter:masterfrom
bkonyi:di/27f-build-system-targets
Oct 9, 2026
Merged

auto-submit[bot] merged 13 commits into
flutter:masterfrom
bkonyi:di/27f-build-system-targets

Conversation

@bkonyi

@bkonyi bkonyi commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Migrates build system targets (ShaderCompiler, Android, and common targets), FlutterTesterDevice, application packages, ProtocolDiscovery, AnalysisServer, and UnifiedAnalytics wiring away from globals.dart to explicit dependency injection.

Part of #188471

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

bkonyi added 5 commits October 1, 2026 03:40
…droid, and targets/common

Make Xcode optional on AOTSnapshotter since it is only used when targeting Apple platforms, allowing AndroidAot and AotElfBase in targets/android.dart and targets/common.dart to omit globals.xcode. Pass environment.platform to ShaderCompiler in copyAssets and remove the globals.platform lookup from ShaderCompiler.
@bkonyi bkonyi added tool Affects the "flutter" command-line tool. See also t: labels. CICD Run CI/CD labels Oct 1, 2026
@bkonyi
bkonyi requested review from a team as code owners October 1, 2026 15:07
@bkonyi bkonyi added tool Affects the "flutter" command-line tool. See also t: labels. CICD Run CI/CD labels Oct 1, 2026
@bkonyi
bkonyi requested review from jesswrd and removed request for a team October 1, 2026 15:07
@github-actions github-actions Bot added team-android Owned by Android platform team team-ios Owned by iOS platform team team-macos Owned by the macOS platform team labels Oct 1, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@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 refactors AOTSnapshotter to make the Xcode parameter optional, updating various build targets to either omit it or pass it as nullable. It also refactors ShaderCompiler to default to const LocalPlatform() instead of using global state. Feedback on these changes suggests replacing a null assertion operator (!) on _xcode in AOTSnapshotter with a local null check and a descriptive error message to adhere to the style guide and improve error clarity.

@bkonyi
bkonyi marked this pull request as draft October 1, 2026 15:23
@flutter-dashboard

Copy link
Copy Markdown

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

bkonyi added 2 commits October 1, 2026 15:27
…eb', 'fork/di/27c-base-and-dart-utils', 'fork/di/27d-test-and-desktop-devices' and 'fork/di/27e-application-packages' into di/27f-build-system-targets
@bkonyi bkonyi changed the title [flutter_tools] Remove globals usage from shader_compiler, targets/android, and targets/common [flutter_tools] Migrate build targets, tester devices, application packages, and tool utilities away from globals Oct 1, 2026
@github-actions github-actions Bot added platform-linux Building on or for Linux specifically a: desktop Running on desktop labels Oct 1, 2026
@bkonyi
bkonyi requested a review from chingjun October 8, 2026 22:50
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 8, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 8, 2026
@auto-submit

auto-submit Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/193647, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 8, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 8, 2026
Merged via the queue into flutter:master with commit 9493534 Oct 9, 2026
29 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 9, 2026
This was referenced Oct 9, 2026
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…ckages, and tool utilities away from globals (flutter#193647)

Migrates build system targets (ShaderCompiler, Android, and common
targets), FlutterTesterDevice, application packages, ProtocolDiscovery,
AnalysisServer, and UnifiedAnalytics wiring away from globals.dart to
explicit dependency injection.

Part of flutter#188471

## 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] All existing and new tests are passing.
definev pushed a commit to definev/flutter that referenced this pull request Oct 29, 2026
… hosts (flutter#194453)

On Linux arm64 hosts, any profile or release Android build fails with a
raw `ProcessException`, because the Flutter SDK does not include
`gen_snapshot` for Android on this host. This PR replaces that with a
`ToolExit` that says the configuration is not supported, shows the path
the tool expected, and links the feature request.

If a `gen_snapshot` has been placed at the expected path (for example, a
self-built binary), the build still uses it, so existing workarounds
keep working.

Since flutter#193647 the build target has no access to `OperatingSystemUtils`,
so it recognizes a Linux arm64 host from the `linux-arm64` directory
that the cached artifacts put `gen_snapshot` in. Builds that use a local
engine are not affected.

Output of the `flutter assemble` step that `flutter build apk --release`
runs, captured in a linux/arm64 Debian container with the SDK at
`/flutter` (master 8274c72, then with this change applied):

Before:

```
Target android_aot_release_android-arm64 failed: ProcessException: Failed to find "/flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/gen_snapshot" in the search path.
  Command: /flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/gen_snapshot
```

After:

```
Target android_aot_release_android-arm64 failed: Error: Building Android apps in release mode is not supported on Linux arm64 hosts because the Flutter SDK does not include gen_snapshot for this host (expected at /flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/gen_snapshot).
See flutter#75864 for details.
```

This does not add Linux arm64 host support for Android builds; that is
tracked in 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 [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md
[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/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD platform-linux Building on or for Linux specifically team-android Owned by Android platform team team-ios Owned by iOS platform team team-linux Owned by the Linux platform team team-macos Owned by the macOS platform team 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