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

fix: update Expo plugin to be compatible with objcpp #6223

Merged
merged 5 commits into from
Apr 28, 2022

Conversation

kbrandwijk
Copy link
Contributor

@kbrandwijk kbrandwijk commented Apr 28, 2022

Description

Expo SDK 45, which is now in beta, has switched to using objcpp for AppDelegate on iOS. The current import syntax, using @import, is incompatible with this. Therefore, SDK 45 beta users using the config plugin are experiencing build issues. This change is backwards compatible with cpp, Firebase switched to it 2 years ago (firebase/FirebaseUI-iOS#875 and the linked PR in that issue).

Related issues

Fixes #6221

Release Summary

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


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

@vercel
Copy link

vercel bot commented Apr 28, 2022

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

Name Status Preview Updated
react-native-firebase ✅ Ready (Inspect) Visit Preview Apr 28, 2022 at 0:22AM (UTC)
1 Ignored Deployment
Name Status Preview Updated
react-native-firebase-next ⬜️ Ignored (Inspect) Apr 28, 2022 at 0:22AM (UTC)

@kbrandwijk kbrandwijk changed the title [app] update Expo plugin to be compatible with objcpp fix: update Expo plugin to be compatible with objcpp Apr 28, 2022
@CLAassistant
Copy link

CLAassistant commented Apr 28, 2022

CLA assistant check
All committers have signed the CLA.

@kbrandwijk

This comment was marked as resolved.

Copy link
Contributor

@barthap barthap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks 😁 I missed that change in my PR.

@@ -19,7 +19,7 @@ export function modifyObjcAppDelegate(contents: string): string {
contents = contents.replace(
/#import "AppDelegate.h"/g,
`#import "AppDelegate.h"
@import Firebase;`,
#import <Firebase/Firebase.h>`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the RNFB docs, I don't know if it shouldn't be #import <Firebase.h> 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we use to advice using @import Firebase a long time ago, but we also switched, maybe that's the confusion?

Either way this reminded me of some previous issues, and in triage of those we made sure both ways work (or, worked - @import won't work now I understand that:
#4069

Also, I made this change myself recently in my demo script - which hadn't been updated from @import style yet, and I can say I know this is working as well with new style:
mikehardy/rnfbdemo@cfed4d8#diff-3e27ae623577d0c559bd8ab973a0c34af8cc65ef9beb9868a9cdb029854f8078R33

Which is all to say: I'm pretty comfortable this will be backwards compatible (excellent!) and also I know for RN68 you need it as well

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! And yes, I discovered it was needed as well, when I updated my demo script to the RN68 builds, but didn't think of the expo plugins here :-). Thanks for posting this, and sorry about the CLA-bot hassle - who knows what happened there
I'll push a patch release in a moment

@@ -19,7 +19,7 @@ export function modifyObjcAppDelegate(contents: string): string {
contents = contents.replace(
/#import "AppDelegate.h"/g,
`#import "AppDelegate.h"
@import Firebase;`,
#import <Firebase/Firebase.h>`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we use to advice using @import Firebase a long time ago, but we also switched, maybe that's the confusion?

Either way this reminded me of some previous issues, and in triage of those we made sure both ways work (or, worked - @import won't work now I understand that:
#4069

Also, I made this change myself recently in my demo script - which hadn't been updated from @import style yet, and I can say I know this is working as well with new style:
mikehardy/rnfbdemo@cfed4d8#diff-3e27ae623577d0c559bd8ab973a0c34af8cc65ef9beb9868a9cdb029854f8078R33

Which is all to say: I'm pretty comfortable this will be backwards compatible (excellent!) and also I know for RN68 you need it as well

@mikehardy mikehardy added the Workflow: Pending Merge Waiting on CI or similar label Apr 28, 2022
@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #6223 (cd07ad6) into main (0fd4b4f) will decrease coverage by 27.60%.
The diff coverage is n/a.

❗ Current head cd07ad6 differs from pull request most recent head 4269c8e. Consider uploading reports for the commit 4269c8e to get more accurate results

@@              Coverage Diff              @@
##               main    #6223       +/-   ##
=============================================
- Coverage     53.40%   25.80%   -27.59%     
=============================================
  Files           208       97      -111     
  Lines         10302     4283     -6019     
  Branches       1633     1046      -587     
=============================================
- Hits           5501     1105     -4396     
+ Misses         4543     2579     -1964     
- Partials        258      599      +341     

@mikehardy mikehardy merged commit 9de82d3 into invertase:main Apr 28, 2022
@mikehardy mikehardy removed the Workflow: Pending Merge Waiting on CI or similar label Apr 28, 2022
@mikehardy
Copy link
Collaborator

I'm short-cutting some of the CI steps because I just ran through everything and did a release yesterday, plus I know which aspects could/would change based on these file edits. So I've merged it after seeing the affected jobs complete and likewise I know what's affected on main (nothing, vs this PR) so I just kicked off the publish workflow. Should have a patch version up on npmjs.com in a few minutes. Cheers!

@nandorojo
Copy link
Contributor

I was just about to open an issue, thank you for this!

barthap pushed a commit to expo/expo that referenced this pull request May 11, 2022
* Update setup-native-firebase.md

After doing some research, I came across [this](invertase/react-native-firebase#6223) Pull Request, suggesting to instead import Firebase with `#import <Firebase/Firebase.h>` as opposed to `@import Firebase;` for SDK 45.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐛] Expo SDK 45 error - Can't compile AppDelegate.mm [Fixed in 14.9.1 ✨ ]
5 participants