[tool] Fix fetch-deps handling of SwiftPM#11261
Conversation
flutter#11258 did not work correctly to disable CocoaPods (i.e., to fix the tree breakage on `stable`) because it only added the config flag around the `flutter build`. When caching Dart deps as well, the `flutter pub get` call will cause `Podfile` to be recreated if SwiftPM support isn't enabled, and once it's present, `build` will try to use CocoaPods even with SwiftPM support enabled, because it looks like a project that is still using CocoaPods. This fixes that by: - Applying the override for the entire set of commands, not just `build`. - Applying the override to the plugin as well as the example, because `flutter pub get` on a package automatically sub-runs on the example, and it appears that it does so using the config flags of the top-level package.
|
I tested this locally on |
There was a problem hiding this comment.
Code Review
The pull request refactors the handling of Swift Package Manager (SwiftPM) configuration overrides within the fetch_deps_command.dart. The temporary SwiftPM override logic, previously duplicated and embedded within platform-specific dependency fetching for iOS and macOS, is now centralized. The override is applied once at the beginning of the runForPackage method for both the main package and its examples, and then consistently removed at the end of the method, simplifying platform-specific code paths. A new test case in fetch_deps_command_test.dart validates that the SwiftPM override is correctly applied before pub get and subsequently reverted for both plugin and example packages.
|
Looks like the Android device tests are really slow again today. Since this PR doesn't affect any of the Android tests that are in progress, and this fixes tree breakage, landing manually. |
flutter/packages@0f2eeae...a9d36fb 2026-03-16 [email protected] [tool] Apply SwiftPM to non-plugin builds too (flutter/packages#11265) 2026-03-16 [email protected] [tool] Fix fetch-deps handling of SwiftPM (flutter/packages#11261) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
#11258 did not work correctly to disable CocoaPods (i.e., to fix the tree breakage on `stable`) because it only added the config flag around the `flutter build`. When caching Dart deps as well, the `flutter pub get` call will cause `Podfile` to be recreated if SwiftPM support isn't enabled, and once it's present, `build` will try to use CocoaPods even with SwiftPM support enabled, because it looks like a project that is still using CocoaPods. This fixes that by: - Applying the override for the entire set of commands, not just `build`. - Applying the override to the plugin as well as the example, because `flutter pub get` on a package automatically sub-runs on the example, and it appears that it does so using the config flags of the top-level package.
#11258 did not work correctly to disable CocoaPods (i.e., to fix the tree breakage on
stable) because it only added the config flag around theflutter build. When caching Dart deps as well, theflutter pub getcall will causePodfileto be recreated if SwiftPM support isn't enabled, and once it's present,buildwill try to use CocoaPods even with SwiftPM support enabled, because it looks like a project that is still using CocoaPods.This fixes that by:
build.flutter pub geton a package automatically sub-runs on the example, and it appears that it does so using the config flags of the top-level package.