Skip to content
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

feat(app, sdk): allow env var override of firebase-ios-sdk value #8147

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

mikehardy
Copy link
Collaborator

Description

When there are build breaks like happened with firebase-ios-sdk 11.4.1, people need to override the firebase-ios-sdk value, but it is not easy to do in a managed / no-native-code environment like Expo where you cannot easily modify the Podfile

It easy to send an environment variable through though, so I checked overriding it that way, and not only does it work but it is sufficient to do so in the RNFBApp.podspec alone

No config plugin needed, no dangerous Podfile mod needed

I also took the opportunity to make the risk of overriding the SDK versions much more specific, since users are still surprised by build errors when we adopt new SDK semver minors and start using the new symbols, while users with overrides don't get the new SDK and have a build error

Related issues

Release Summary

Some conventional commits, rebase-merge should do it

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

In an expo app with react-native-firebase (app, and others) installed, expo-dev-client installed, run:

yarn expo prebuild --clean

You should see 11.5.0 pods installed by default at the time of this writing, it works just fine still, with no environment variable specified

Then do it again but with 11.4.2 specified via environment variable, see they all get switched:

mike@isabela:~/work/expo-random/RNFBWebTest/ios (main) % FIREBASE_SDK_VERSION=11.4.2 pod install
Using Expo modules
[Expo] Enabling modular headers for pod ExpoModulesCore
[Expo] Enabling modular headers for pod React-Core
[Expo] Enabling modular headers for pod React-RCTAppDelegate
[Expo] Enabling modular headers for pod
expo-dev-menu-interface
[Expo] Enabling modular headers for pod EXManifests
[Expo] Enabling modular headers for pod EXUpdatesInterface
[Expo] Enabling modular headers for pod expo-dev-menu
[Expo] Enabling modular headers for pod React-jsinspector
[Expo] Enabling modular headers for pod RCT-Folly
[Expo] Enabling modular headers for pod glog
[Expo] Enabling modular headers for pod React-RCTFabric
[Expo] Enabling modular headers for pod ReactCodegen
[Expo] Enabling modular headers for pod RCTRequired
[Expo] Enabling modular headers for pod RCTTypeSafety
[Expo] Enabling modular headers for pod ReactCommon
[Expo] Enabling modular headers for pod
React-NativeModulesApple
[Expo] Enabling modular headers for pod Yoga
[Expo] Enabling modular headers for pod React-Fabric
[Expo] Enabling modular headers for pod React-graphics
[Expo] Enabling modular headers for pod React-utils
[Expo] Enabling modular headers for pod React-featureflags
[Expo] Enabling modular headers for pod React-debug
[Expo] Enabling modular headers for pod React-ImageManager
[Expo] Enabling modular headers for pod React-rendererdebug
[Expo] Enabling modular headers for pod DoubleConversion
[Expo] Enabling modular headers for pod hermes-engine
[Expo] Enabling modular headers for pod expo-dev-launcher
RNFBAnalytics: Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps.
RNFBAnalytics: You may set variable `$RNFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids.
RNFBApp: Found Firebase SDK version in environment '11.4.2'
RNFBApp: Using user specified Firebase SDK version '11.4.2'
RNFBAppCheck: Using user specified Firebase SDK version '11.4.2'
RNFBAuth: Using user specified Firebase SDK version '11.4.2'
RNFBDatabase: Using user specified Firebase SDK version '11.4.2'
RNFBFirestore: Using user specified Firebase SDK version '11.4.2'
RNFBFunctions: Using user specified Firebase SDK version '11.4.2'
RNFBRemoteConfig: Using user specified Firebase SDK version '11.4.2'
RNFBStorage: Using user specified Firebase SDK version '11.4.2'
Found 15 modules for target `RNFBWebTest`

(lots of other stuff)


Installing Firebase 11.4.2 (was 11.5.0)
Installing FirebaseABTesting 11.4.0 (was 11.5.0)
Installing FirebaseAnalytics 11.4.0 (was 11.5.0)
Installing FirebaseAppCheck 11.4.0 (was 11.5.0)
Installing FirebaseAuth 11.4.0 (was 11.5.0)
Installing FirebaseCore 11.4.2 (was 11.5.0)
Installing FirebaseCoreExtension 11.4.1 (was 11.5.0)
Installing FirebaseDatabase 11.4.0 (was 11.5.0)
Installing FirebaseFirestore 11.4.0 (was 11.5.0)
Installing FirebaseFirestoreInternal 11.4.0 (was 11.5.0)
Installing FirebaseFunctions 11.4.0 (was 11.5.0)
Installing FirebaseInstallations 11.4.0 (was 11.5.0)
Installing FirebaseRemoteConfig 11.4.0 (was 11.5.0)
Installing FirebaseStorage 11.4.0 (was 11.5.0)
Installing GoogleAppMeasurement 11.4.0 (was 11.5.0)
Installing RNFBAnalytics 21.5.0
Installing RNFBApp 21.5.0
Installing RNFBAppCheck 21.5.0
Installing RNFBAuth 21.5.0
Installing RNFBDatabase 21.5.0
Installing RNFBFirestore 21.5.0
Installing RNFBFunctions 21.5.0
Installing RNFBRemoteConfig 21.5.0
Installing RNFBStorage 21.5.0

So it appears to work as expected with one little stanza in RNFBApp.podspec, and it doesn't break if no env var is specified


Think react-native-firebase is great? Please consider supporting the project with any of the below:

Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 7:37pm

This should make it easier for Expo folks to override the SDK when
they need to
@mikehardy mikehardy force-pushed the @mikehardy/firebase-ios-sdk-from-env-var branch from 38b754a to c4b88f0 Compare November 19, 2024 19:32
@mikehardy
Copy link
Collaborator Author

oops, re-pushed after reading how to use ENV correctly in ruby

https://docs.ruby-lang.org/en/master/ENV.html#method-c-include-3F

@mikehardy mikehardy merged commit 8cbe59f into main Nov 20, 2024
19 checks passed
@mikehardy mikehardy deleted the @mikehardy/firebase-ios-sdk-from-env-var branch November 20, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support a plugin or an effective method for Expo users to specify firebase-ios-sdk version
2 participants