Repository navigation
[flutter_tools] Migrate build targets, tester devices, application packages, and tool utilities away from globals - #193647
Conversation
…ce away from globals
… away from globals
…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.
|
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. |
There was a problem hiding this comment.
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.
|
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 Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
…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
|
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. |
…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.
… 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
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
///).