-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add modular headers support to Objective-C Firebase pods for static framework compatibility #15506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add modular headers support to Objective-C Firebase pods for static framework compatibility #15506
Conversation
…ramework compatibility This commit adds DEFINES_MODULE = YES to the pod_target_xcconfig section of FirebaseCore, FirebaseInstallations, and FirebaseCoreExtension podspecs. ## Problem Swift-based Firebase pods (FirebaseCoreInternal, FirebaseCrashlytics, FirebaseSessions) depend on Objective-C Firebase pods. When using static frameworks via 'use_frameworks! :linkage => :static', Swift cannot import Objective-C dependencies unless those dependencies define module maps. This prevents React Native (New Architecture), Expo, and other frameworks from using Firebase with static linking, resulting in errors like: - "The Swift pod X depends upon Y, which does not define modules" - "include of non-modular header inside framework module" ## Solution Enable module map generation by adding 'DEFINES_MODULE' => 'YES' to the pod_target_xcconfig in: - FirebaseCore.podspec - FirebaseInstallations.podspec - FirebaseCoreExtension.podspec (new section added) When DEFINES_MODULE is enabled, CocoaPods automatically generates module.modulemap files, allowing Swift code to properly import these Objective-C dependencies in static framework builds. ## Impact - Enables static framework usage for React Native, Expo, and other frameworks - Maintains full backward compatibility with existing projects - No breaking changes - dynamic frameworks continue to work as before - Aligns with modern iOS build practices and CocoaPods best practices ## Testing All modified podspecs pass validation: - pod spec lint FirebaseCore.podspec --quick --allow-warnings - pod spec lint FirebaseInstallations.podspec --quick --allow-warnings - pod spec lint FirebaseCoreExtension.podspec --quick --allow-warnings ## Related Issues Resolves firebase#15249 Related to: - invertase/react-native-firebase#6933 - invertase/react-native-firebase#6332 - expo/expo#39607 ## Note External dependencies (GoogleUtilities, GoogleDataTransport, nanopb) are maintained in separate repositories and would benefit from similar changes for complete resolution.
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds modular headers support to key Objective-C Firebase pods, which is a crucial fix for compatibility with static framework builds, especially for React Native and Expo users. The changes are clear, well-motivated, and correctly implemented by setting DEFINES_MODULE = YES. The detailed explanation in the pull request description is very helpful. I have one minor stylistic suggestion to improve consistency across the podspec files.
ncooke3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MichaelBernhardt!
Summary
Adds
DEFINES_MODULE = YESto FirebaseCore, FirebaseInstallations, and FirebaseCoreExtension podspecs to enable module map generation for static framework builds.Motivation
Swift-based Firebase pods (FirebaseCoreInternal, FirebaseCrashlytics, FirebaseSessions) depend on these Objective-C pods. When using static frameworks (
use_frameworks! :linkage => :static), Swift cannot import Objective-C dependencies unless they define modules.This currently prevents React Native (New Architecture), Expo, and other frameworks from using Firebase with static linking, causing build failures with errors like:
The Swift pod X depends upon Y, which does not define modulesinclude of non-modular header inside framework moduleChanges
Added
'DEFINES_MODULE' => 'YES'topod_target_xcconfigin:When
DEFINES_MODULEis enabled, CocoaPods automatically generatesmodule.modulemapfiles during pod installation, enabling Swift to import these Objective-C modules in static framework builds.Testing
All modified podspecs pass CocoaPods validation:
Impact
Related Issues
This resolves #15249 and addresses issues reported across the ecosystem:
Additional Context
External dependencies (GoogleUtilities, GoogleDataTransport, nanopb) are maintained in separate repositories and would benefit from similar changes. However, this PR resolves the issue for all Firebase-owned Objective-C pods within this repository.
I've tested this change locally and confirmed it resolves the static framework build issues while maintaining full backward compatibility with existing projects using dynamic frameworks.