Repository navigation
feat(spm): Package.swift for the Firebase tvOS ports (core and all dependents) - #27
Conversation
MAUstaoglu
left a comment
There was a problem hiding this comment.
Thanks for this! The package_info_plus_tvos part looks good, but the firebase part breaks builds as it stands.
Blocking
- Other firebase pods can't find
firebase_core_tvos. flutter-tvos's Podfile skips any plugin that ships atvos/Package.swift. Nine other ports still declares.dependency 'firebase_core_tvos'in their podspecs: auth, firestore, functions, app_check, crashlytics, messaging, performance, remote_config and storage. With core 0.0.4, an app that uses any of them failspod installwith "Unable to find a specification for firebase_core_tvos". Even if it resolved, FirebaseCore would be linked twice, once through SwiftPM and once through CocoaPods. The firebase ports need to move to SwiftPM together. firebase_analytics_tvosstill pinsfirebase_core_tvos: ^0.0.1. For a 0.0.x version, that means exactly 0.0.1, which has noPackage.swift, so.package(path: "../firebase_core_tvos")can't resolve. An app that also follows the core README (^0.0.4) failspub getwith a version conflict. It should be^0.0.4.
Should fix
- Firebase version range:
.package(url: firebase-ios-sdk, from: "12.15.0")accepts any 12.x, while the podspecs'~> 12.15.0only accepts 12.15.x..upToNextMinor(from: "12.15.0")matches the podspec. - Library registration under SwiftPM:
FLTFirebasePluginRegistry.monly callsregisterLibrarywhenFIRAppInternal.hcan be found. Please confirmREGISTER_LIBis still defined in a SwiftPM build. If it isn't, registration is skipped silently. - README and CHANGELOG: they say CocoaPods projects keep using the podspec and that nothing changes. In flutter-tvos, a plugin that ships a
Package.swiftis always linked through SwiftPM and skipped by the Podfile. LIBRARY_VERSION: it is still"0.0.1", while the package is now 0.0.4.
Suggestion
Could you split package_info_plus_tvos into its own PR? That part can be merged as is. Then move the firebase ports to SwiftPM together in a separate PR, with the core dependency raised to ^0.0.4.
…pendents) flutter-tvos links a plugin that ships tvos/Package.swift through SwiftPM and leaves it out of the Podfile. Once firebase_core_tvos ships one, a port that still says `s.dependency 'firebase_core_tvos'` in its podspec cannot resolve, so core and every port that depends on it move to SwiftPM together. - firebase_core_tvos 0.0.4: one Objective-C target, include/ as the public headers. LIBRARY_VERSION now matches the package version. - Swift ports (analytics 0.0.2, app_check 0.0.3, cloud_functions 0.0.2, performance 0.0.2, remote_config 0.0.2, storage 0.0.2): one Swift target. - Objective-C ports (cloud_firestore 0.0.2, auth 0.0.2, messaging 0.0.2): one Objective-C target. Core headers resolve as <firebase_core/...> under SwiftPM. - firebase_crashlytics_tvos 0.0.3: a Swift and an Objective-C target, sources split into Classes/firebase_crashlytics_tvos and Classes/firebase_crashlytics_objc like upstream. The podspec globs match both. - Every manifest takes firebase-ios-sdk .upToNextMinor(from: "12.15.0"), the podspecs' ~> 12.15.0, and dependents reach core as ../firebase_core_tvos. - Every dependent requires firebase_core_tvos ^0.0.4. The six without one get a root pubspec_overrides.yaml, and their examples override core to the sibling package and move to upstream versions that accept core 0.0.4. Library registration: under SwiftPM FIRAppInternal.h is unreachable (FirebaseCoreExtension is no product of firebase-ios-sdk), so REGISTER_LIB was never defined. FLTFirebasePluginRegistry.m now declares +[FIRApp registerLibrary:withVersion:] when neither header is found and checks respondsToSelector: before calling it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ebaseCore, flutter-tvos floor - All ten dependents carry the same root and example/pubspec_overrides.yaml: they resolve firebase_core_tvos from the sibling package so the repo's CI builds against the in-repo 0.0.4 until it is on pub.dev, and can be deleted then. The six examples that had dependency_overrides in pubspec.yaml now use example/pubspec_overrides.yaml like the other four. - Each dependent's .pubignore excludes pubspec_overrides.yaml (root and example/, check_repo R4) and repeats the package's .gitignore rules, since a .pubignore replaces that directory's .gitignore for `dart pub publish`. - firebase_app_check_tvos: Package.swift declares the FirebaseCore product, which FirebaseAppCheckPlugin.swift imports directly. - READMEs: SwiftPM needs flutter-tvos 1.3.0 or later (the release that added SwiftPM plugin linking, the side-by-side package layout and the Podfile skip). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bef4bc8 to
40d6f56
Compare
|
Thanks for the careful review. You were right on every point. I reworked the PR:
This time I tested much more before pushing:
One thing to decide: core 0.0.4 has to reach pub.dev before the ten dependents. Until then they resolve through |
The June SwiftPM pass covered the Swift method-channel plugins. This one was left on CocoaPods because it is Objective-C. One Objective-C target over the unchanged Classes/, public headers in include/package_info_plus. Split out of #27 as the reviewer asked. Patch bump to 0.0.2 with a CHANGELOG entry and a README note. No API change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MAUstaoglu
left a comment
There was a problem hiding this comment.
Thanks for the thorough rework: every point from the earlier review is addressed, and CI is green. firebase_core_tvos 0.0.4 will be published before the dependents.
What does this PR do?
Moves
firebase_core_tvosand every Firebase tvOS port that depends on it to Swift Package Manager together, as asked in the first review. Each gets atvos/Package.swift, so flutter-tvos links it through SwiftPM and leaves it out of the Podfile.package_info_plus_tvosmoved to its own PR, #31.Package(s) touched: firebase_core_tvos 0.0.4, cloud_firestore_tvos 0.0.2, cloud_functions_tvos 0.0.2, firebase_analytics_tvos 0.0.2, firebase_app_check_tvos 0.0.3, firebase_auth_tvos 0.0.2, firebase_crashlytics_tvos 0.0.3, firebase_messaging_tvos 0.0.2, firebase_performance_tvos 0.0.2, firebase_remote_config_tvos 0.0.2, firebase_storage_tvos 0.0.2.
firebase_ai_tvosis left out: it has no core or Firebase SDK dependency.What changed, by review point:
.package(path: "../firebase_core_tvos"). FirebaseCore is linked once.firebase_core_tvos: ^0.0.4..upToNextMinor(from: "12.15.0")in every manifest, matching the podspecs'~> 12.15.0.REGISTER_LIB: it was not defined under SwiftPM. A#warningprobe confirmed it. firebase-ios-sdk vends noFirebaseCoreExtensionproduct, so neither__has_includecan match.FLTFirebasePluginRegistry.mnow declares+[FIRApp registerLibrary:withVersion:]itself in that case and checksrespondsToSelector:before calling it. On the simulator, Firebase's user agent then lists the registered libraries (core-tvos 0.0.4, appcheck, auth-tvos, cls, fcm-tvos, rc) anddeploy/swiftpm.tvos/Package.swiftthrough SwiftPM and leaves it out of the Podfile. The READMEs name flutter-tvos 1.3.0 as the minimum.LIBRARY_VERSION: in the four Objective-C ports (core, auth, firestore, messaging) it matches each new package version. The Swift ports keep upstream'sversionNumber.Target layout: Swift-only ports are one Swift target. core, auth, messaging and firestore are one Objective-C target each. Crashlytics 5.3.0 mixes Swift and Objective-C, so its sources are split into two folders and two targets, as upstream FlutterFire does. The Objective-C ports gained a
<firebase_core/...>import branch, the header path under SwiftPM. The podspecs are kept and still match the sources.How was it tested?
example/apps (built all 11)dart analyzeis clean for every touched package and example (only infos in example code that this PR doesn't touch)All builds use flutter-tvos 1.11.0 with
flutter-tvos build tvos --simulator:example/app of all 11 packages, debugIn every build: 0 pods in
Podfile.lock, the FIRApp class defined once across the binary and embedded frameworks, firebase-ios-sdk resolved to 12.15.0.On the simulator, the all-ports app ran
Firebase.initializeAppand called each dependent plugin. Analytics, App Check, Auth, Crashlytics, Firestore, Messaging, Performance and Remote Config returned. Functions and Storage returned server errors (not-found,object-not-found), so their native side answered. NoMissingPluginException.CI steps run locally for all 11 packages:
check_repo.py .and--selftest,release_plan.py,flutter pub get,dart analyze,flutter test,flutter pub publish --dry-run(no warnings). I used Flutter 3.44.6 (CI pins 3.44.0) and 3.47.5.Not tested: a CocoaPods-only build of the podspecs, and a physical Apple TV.
Versioning & changelog
version:in each package'spubspec.yaml, with each podspec'ss.versionto matchCHANGELOG.md, under a heading identical to the new versionChecklist
TODO/debug leftovers in the difffirebase_ai_tvosis unaffected (no core dependency)Notes for reviewers
Publish order matters. The dependents need
firebase_core_tvos0.0.4 on pub.dev before they can resolve. Until then, each dependent has apubspec_overrides.yaml(root andexample/) that points at the in-repo core, so CI resolves. Each file says it can be deleted once core 0.0.4 is published, and.pubignorekeeps it out of the archive.release.ymlpublishes candidates in parallel, so core should go first. Published users are safe meanwhile: every published dependent caps core below 0.0.4, so pub never pairs core 0.0.4 with an old podspec-only port. If you'd rather avoid the overrides, I can split this into core 0.0.4 first and the ten dependents after it is published.Example apps: four examples pinned upstream versions that no core_tvos from 0.0.3 on accepts. They moved to the first versions that do: firebase_core 4.14.0, firebase_analytics 12.4.6, cloud_functions 6.3.6, firebase_performance 0.11.4+6, firebase_remote_config 6.5.6. All are within the packages' own constraints.
Firebase 12.15.x: with
.upToNextMinor, an app that also takes another SwiftPM package needing firebase-ios-sdk 12.16 or later cannot resolve. Moving the floor is a separate decision, so I kept 12.15 to match the podspecs.Messaging privacy manifest:
Resources/PrivacyInfo.xcprivacyis not shipped under SwiftPM or CocoaPods today. That predates this PR. I can add it as a SwiftPM resource in a follow-up.🤖 Generated with Claude Code