Skip to content

[tool] Fix fetch-deps handling of SwiftPM#11261

Merged
stuartmorgan-g merged 1 commit intoflutter:mainfrom
stuartmorgan-g:fetch-deps-spm-fix
Mar 16, 2026
Merged

[tool] Fix fetch-deps handling of SwiftPM#11261
stuartmorgan-g merged 1 commit intoflutter:mainfrom
stuartmorgan-g:fetch-deps-spm-fix

Conversation

@stuartmorgan-g
Copy link
Collaborator

#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.

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.
@stuartmorgan-g
Copy link
Collaborator Author

I tested this locally on stable this time to make sure it had the intended effect, rather than testing on master that the override was set and assuming that would work (which is what I did last time, since I foolishly thought that would be enough and I didn't actually need to thrash my local Flutter cache).

@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label Mar 16, 2026
Copy link

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

Choose a reason for hiding this comment

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

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.

@stuartmorgan-g
Copy link
Collaborator Author

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.

@stuartmorgan-g stuartmorgan-g merged commit 88afc68 into flutter:main Mar 16, 2026
71 of 81 checks passed
@stuartmorgan-g stuartmorgan-g deleted the fetch-deps-spm-fix branch March 16, 2026 16:25
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 17, 2026
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Mar 17, 2026
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
reidbaker pushed a commit that referenced this pull request Mar 17, 2026
#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants