Repository navigation
fix(app): disable Swift Package Manager to unbreak iOS archives - #11677
Merged
Merged
Conversation
Every iOS archive has failed since #11672: xcodebuild: error: Could not resolve package dependencies: 'firebase_crashlytics-4.3.2' depends on 'flutterfire' 3.11.0-firebase-core-swift and 'firebase_messaging-15.2.5' depends on 'flutterfire' 3.13.0-firebase-core-swift. #11672 moved Codemagic to Flutter 3.44.5 to fix `pub get`. 3.44 also flips a default I did not check: `swiftPackageManager` gained `enabledByDefault: true` on stable, so iOS plugins resolve as Swift packages instead of through CocoaPods. That exposes a skew already in the repo — firebase_crashlytics 4.3.2 declares firebase_core ^3.11.0 while firebase_messaging 15.2.5 declares ^3.13.0, against a pinned core of 3.13.0. CocoaPods tolerates it; SPM will not hold two versions of the same flutterfire package. Restores the plugin resolution that was in production before #11672. The durable fix is aligning the Firebase plugins (#11676, crashlytics 4.3.5 is the release built against core 3.13.0), which changes a shipping app's runtime dependencies and wants an iOS archive as its acceptance test, not a hotfix. Set in pubspec.yaml rather than a Codemagic env var or `flutter config`: the project manifest is first in Flutter's resolution order, so one checked-in place covers local builds and every CI lane. Flutter warns it will stop honouring this, so #11676 is not optional; the comment links it. meta-wearables-dat-ios is unaffected — a direct XCRemoteSwiftPackageReference resolved by Xcode independently of Flutter's plugin SPM integration, and the failing log shows it fetching fine before Flutter's step failed. Verification (no macOS here, so the archive itself is unverified): Negative control proves the key is live and correctly spelled — setting `enable-swift-package-manager: "not-a-bool"` makes pub get exit with 'The "enable-swift-package-manager" property in "flutter: config:" in pubspec.yaml must be a boolean', emitted from _isEnabledAtProjectLevel reading flutterDescriptor['config']. A typo would silently no-op; ruled out. flutter pub get with the real value — Got dependencies!, lockfile unchanged. make preflight — 11/11. .flutter-plugins-dependencies is NOT evidence here: it reports swift_package_manager_enabled false on Linux regardless, because usesSwiftPackageManager also requires Xcode. First real proof is the next Codemagic iOS build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Every iOS archive has failed since #11672 merged:
Disables Swift Package Manager at the project level, restoring the CocoaPods plugin resolution that has been shipping all along. Four lines in
app/pubspec.yaml.Why it broke
#11672 moved Codemagic from Flutter 3.41.9 to 3.44.5 to fix
pub get. That was the right fix for the Dart constraint, but 3.44 also flips a default I did not check. Fromflutter_tools/lib/src/features.dart:3.41.9 resolved iOS plugins through CocoaPods. 3.44.5 resolves them as Swift packages, which exposes a version skew that was already in the repo and invisible under CocoaPods:
app/pubspec.yamlfirebase_core: 3.13.0firebase_messaging: 15.2.5firebase_core: ^3.13.0firebase_crashlytics: 4.3.2firebase_core: ^3.11.0firebase_crashlyticsis two minor versions behind the pinned core. CocoaPods tolerates that; SPM will not hold two versions of the sameflutterfirepackage, so resolution fails outright.Why this fix and not the version bump
The durable fix is aligning the Firebase plugins — tracked in #11676, with
firebase_crashlytics 4.3.5as the release built againstfirebase_core 3.13.0. That is a runtime dependency change to a shipping app whose only real acceptance test is an iOS archive, so it should land deliberately rather than as a hotfix.This change instead restores the exact plugin resolution that was in production before #11672, which is the smallest thing that unblocks the release lanes.
Placed in
pubspec.yamlrather than as a Codemagic env var orflutter configcall: the project manifest is first in Flutter's resolution order (project → global config → environment), so it fixes local builds and every CI lane from one checked-in place, instead of leaving contributors on 3.44.x to rediscover this.Flutter warns that disabling "will not be allowed in a future version", so #11676 is not optional — the comment in
pubspec.yamllinks it.meta-wearables-dat-iosis unaffected: it is a directXCRemoteSwiftPackageReferenceinRunner.xcodeproj, resolved by Xcode independently of Flutter's plugin SPM integration. The failing log shows it fetching successfully before Flutter's step failed.Verification
I have no macOS, so I cannot run the archive that failed. What I could prove locally, I did:
The key is live and correctly spelled. Negative control: setting
enable-swift-package-manager: "not-a-bool"in this pubspec makesflutter pub getexit withThat message is emitted from
_isEnabledAtProjectLevelreadingflutterDescriptor['config']['enable-swift-package-manager'], so Flutter is demonstrably reading this key from this file. A typo would have silently no effect; this rules that out.flutter pub getwith the real value —Got dependencies!, lockfile unchanged.app/test.shon Flutter 3.44.5 with the flag set — 1338 passed, exit 0.make preflight— 11/11.Not verified: the iOS archive.
.flutter-plugins-dependenciesreportsswift_package_manager_enabled: {ios: false, macos: false}on Linux whether or not the flag is set, becauseusesSwiftPackageManagerisfeatureFlags.isSwiftPackageManagerEnabled && compatibleWithSwiftPackageManagerand the second term needs Xcode. So that file is not evidence either way here, and I am not citing it as such. The first real proof is the next Codemagic iOS build.Follow-up