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

Don’t hard-code CocoaPods’s sandbox path #32243

Closed
wants to merge 1 commit into from
Closed

Don’t hard-code CocoaPods’s sandbox path #32243

wants to merge 1 commit into from

Conversation

sonicdoe
Copy link
Contributor

Summary

When running scripts/react_native_pods.rb, the Pods directory may not be in the current working directory, for example, when calling pod install with --project-directory=ios. Therefore, sed fails and, ultimately, the build fails.

Changelog

[iOS] [Fixed] - Fix build error after running pod install with --project-directory=ios

Test Plan

  1. npx react-native init AwesomeProject --version 0.66.0-rc.3 --skip-install
  2. cd AwesomeProject
  3. yarn install
  4. pod install --project-directory=ios

This command prints “sed: Pods/RCT-Folly/folly/portability/Time.h: No such file or directory” but still exits with 0.

  1. npx react-native run-ios

The build fails because of “typedef redefinition with different types” as described in facebook/flipper#834.

  1. Apply this patch using (cd node_modules/react-native && curl https://github.com/kontist/react-native/commit/ec330f756e477e53dde891fe02fd74916d9faef0.patch | patch -p1)
  2. Re-run pod install --project-directory=ios
  3. Re-run npx react-native run-ios

The iOS app should now run successfully.

The `Pods` directory may not be in the current working directory, for example, when calling `pod install` with `--project-directory=ios`.
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Sep 21, 2021
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 6025611

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,705,335 +168
android hermes armeabi-v7a 7,236,558 +400
android hermes x86 8,126,335 +339
android hermes x86_64 8,091,316 +322
android jsc arm64-v8a 9,624,993 +173
android jsc armeabi-v7a 8,543,744 +407
android jsc x86 9,640,286 +359
android jsc x86_64 10,248,954 +329

Base commit: 6025611

@mikehardy
Copy link
Contributor

@sonicdoe thanks very much for carrying this issue / these learnings from #31480 to here as a separate issue. @fkgozali I think this is probably important for react-native 0.66 - tagging you as we collaborated to get the original workaround in, and I'd consider this "mop up"

@fkgozali
Copy link
Contributor

@mikehardy @sonicdoe Thanks so much! This PR has been brought to our team’s attention and we’ll make sure to incorporate it in 0.66.

@facebook-github-bot
Copy link
Contributor

@fkgozali has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@fkgozali merged this pull request in ef5ff3e.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Sep 21, 2021
fkgozali pushed a commit that referenced this pull request Sep 23, 2021
Summary:
When running `scripts/react_native_pods.rb`, the `Pods` directory may not be in the current working directory, for example, when calling [`pod install`](https://guides.cocoapods.org/terminal/commands.html#pod_install) with `--project-directory=ios`. Therefore, `sed` fails and, ultimately, the build fails.

References:
* https://rubydoc.info/gems/cocoapods/Pod%2FInstaller:sandbox
* https://rubydoc.info/gems/cocoapods/Pod/Sandbox#root-instance_method

## Changelog

[iOS] [Fixed] - Fix build error after running `pod install` with `--project-directory=ios`

Pull Request resolved: #32243

Test Plan:
1. `npx react-native init AwesomeProject --version 0.66.0-rc.3 --skip-install`
2. `cd AwesomeProject`
3. `yarn install`
4. `pod install --project-directory=ios`

This command prints “sed: Pods/RCT-Folly/folly/portability/Time.h: No such file or directory” but still exits with 0.

5. `npx react-native run-ios`

The build fails because of “typedef redefinition with different types” as described in facebook/flipper#834.

6. Apply this patch using `(cd node_modules/react-native && curl https://github.com/kontist/react-native/commit/ec330f756e477e53dde891fe02fd74916d9faef0.patch | patch -p1)`
7. Re-run `pod install --project-directory=ios`
8. Re-run `npx react-native run-ios`

The iOS app should now run successfully.

Reviewed By: sota000

Differential Revision: D31089656

Pulled By: fkgozali

fbshipit-source-id: 431898bed88f68761c7e0e6c79074dc04f43ed23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Needs: React Native Team Attention Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants