fix(analytics, messaging): dedupe GoogleUtilities classes under SPM dynamic frameworks - #9327
Draft
russellwheatley wants to merge 1 commit into
Draft
russellwheatley wants to merge 1 commit into
russellwheatley wants to merge 1 commit into
Conversation
russellwheatley
force-pushed
the
feature/cprn-465-9322-spm-dynamic-frameworks-googleutilities-classes
branch
from
September 18, 2026 15:33
e1f0368 to
0dc6c5a
Compare
…ynamic frameworks Under Expo's SPM + dynamic frameworks path, RNFBAnalytics.podspec and RNFBMessaging.podspec only declared their direct Firebase SPM products (FirebaseAnalytics, FirebaseMessaging). GULNetwork, GULReachability, and GULMethodSwizzler were only reachable transitively through those, and Xcode's SPM integration doesn't reliably promote a transitively-only reached product to a shared PackageProduct.framework. It compiled a private copy of each straight into RNFBAnalytics.framework and RNFBMessaging.framework instead, so GULNetwork/GULMutableDictionary/ GULNetworkURLSession/GULReachabilityChecker/GULSessionDeallocTracker/ GULSwizzler ended up defined twice at runtime once both pods were loaded. The fix declares those same GoogleUtilities products as an explicit top-level spm_dependency on both podspecs, the same way GULAppDelegateSwizzler already was. That's enough for Xcode to treat them as shared and build one dynamic framework per product instead of duplicating them. test-expo-ios-link.sh gained a new #9322 check that walks every built .framework, nm's its undefined/external symbols, and fails if any of the affected GUL classes are defined in more than one framework or privately inside RNFBAnalytics/RNFBMessaging rather than a shared PackageProduct. Also removed the hardcoded CC=clang/LD=clang xcodebuild args, which broke pure-Swift SPM targets pulled in by this repro (FirebaseCoreInternal).
russellwheatley
force-pushed
the
feature/cprn-465-9322-spm-dynamic-frameworks-googleutilities-classes
branch
from
September 18, 2026 15:46
0dc6c5a to
9a052ab
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9327 +/- ##
============================================
+ Coverage 69.49% 69.83% +0.35%
- Complexity 2129 2130 +1
============================================
Files 439 439
Lines 25472 25518 +46
Branches 4251 4257 +6
============================================
+ Hits 17700 17819 +119
+ Misses 6365 6358 -7
+ Partials 1407 1341 -66
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
RNFBAnalytics.podspecandRNFBMessaging.podspeconly declared their direct Firebase SPM product (FirebaseAnalytics,FirebaseMessaging). Before this fix,GULNetwork,GULReachability, andGULMethodSwizzlerended up compiled privately into bothRNFBAnalytics.frameworkandRNFBMessaging.frameworkinstead of a single shared dynamic framework, so severalGUL*classes were defined twice at runtime once both pods were loaded together.Confirmed: the raw
FirebaseAnalytics/GoogleAppMeasurement.xcframeworkbinaries don't bake in copies of these classes (checked withnm), they only reference them as undefined externals like any source-based product.Not fully confirmed: why Xcode's SPM integration fails to promote this specific cluster to a shared framework once Analytics is in the graph, when an equivalent pure-source pairing (Messaging + Auth, sharing the
GULAppDelegateSwizzlercluster instead) promotes cleanly with zero private copies. It isn't simply "transitive vs explicit" either: firebase-ios-sdk's ownPackage.swiftalready listsGULNetwork/GULMethodSwizzleras explicit top-level products onFirebaseAnalyticsWrapper, in the same array asGULAppDelegateSwizzler, and only the latter shared correctly. Whether Analytics's target also carrying a binaryTarget dependency changes Xcode's per-target sharing heuristic is a live, untested hypothesis.What's confirmed to fix it: declaring these same GoogleUtilities products as an explicit top-level
spm_dependencydirectly on both podspecs makes Xcode build one shared dynamic framework per product and link bothRNFBAnalyticsandRNFBMessagingagainst it.test-expo-ios-link.shgained a check that walks every built.frameworkunder the Expo SPM dynamic frameworks path,nm's its symbols, and fails if any of the affectedGUL*classes are defined in more than one framework, or privately insideRNFBAnalytics/RNFBMessagingrather than a shared package product. Verified it fails without the podspec change and passes with it.Also dropped the hardcoded
CC=clang/LD=clangxcodebuild args in that script, they broke the pure-Swift SPM target (FirebaseCoreInternal) this repro pulls in once Analytics is added alongside Messaging.Maintainer note: Fixes internal CPRN-465