react-native/scripts
Kræn Hansen dc959c9271 Update react-native-xcode.sh to use PROJECT_DIR from Xcode (#35970)
Summary:
In a mono-repo the `react-native` package could be hoisted compared to the app directory, in which case it's not a good strategy for the `react-native-xcode.sh` script to guess the app project root relative to the location of itself. Instead I suggest to relying on a build setting provided by Xcode to derive the default app path.

I could have use the `SRCROOT` instead. According to https://stackoverflow.com/questions/36323031/what-the-different-between-srcroot-and-project-dir this is equivalent and also a bit less ambiguous as I see it. I.e. I would expect most Xcode projects to be located in the `ios` directory of the app.

As a workaround, before this merge, users can add the following to their "Bundle React Native code and images" build phase or `ios/.xcode.env` file:

```shell
export PROJECT_ROOT="$PROJECT_DIR/.."
```

This build phase can also be used for users wanting to revert this default behaviour once merged.

## Changelog

[iOS] [Changed] - Changed default `PROJECT_ROOT` (used in when bundling for iOS) to rely on the `PROJECT_DIR` build setting.

Pull Request resolved: https://github.com/facebook/react-native/pull/35970

Test Plan:
I've updated this locally and verified this does indeed pick up the correct app path - even in a mono-repo.

To verify this:
- Instantiate the template with this patch applied.
- Update the "Run scheme"'s "Build Configuration" to "Release".
- Build the app without errors.

Reviewed By: cortinico

Differential Revision: D42842636

Pulled By: cipolleschi

fbshipit-source-id: 040c31ac59a8abec5f5b38f795c8e74649420bac
2023-01-30 04:03:31 -08:00
..
__tests__ refactor(scripts/monorepo/tests): moved related tests to scripts/monorepo/__tests__ 2023-01-10 13:23:06 -08:00
circleci fix(release scripts): backport fixes from 0.71 into main (#35258) 2022-11-08 10:03:29 -08:00
cocoapods Use FileMock and DirMock instead of Monkey Patching (#35792) 2023-01-10 06:43:39 -08:00
codegen chore: renamed react-native-codegen to @react-native/codegen (#34804) 2022-11-28 08:28:51 -08:00
hermes Remove version from the tarball (#35285) 2022-11-14 08:31:30 -08:00
monorepo refactor(bump-all-updated-packages): support force-bump to next minor version of the package (#35810) 2023-01-12 03:35:41 -08:00
react_native_pods_utils fix: script phases warning (#35594) 2022-12-08 09:05:56 -08:00
template refactor(scripts): use forEachPackage instead of yarn workspaces info (#35633) 2022-12-14 03:04:06 -08:00
versiontemplates
xcode
.npmignore Move TypeScript declarations into react-native (#34614) 2022-09-19 12:26:00 -07:00
.packager.env
.tests.env Bump OSS Android build to SDK 33 (#35196) 2022-11-08 19:12:02 -08:00
android-e2e-test.js
android-setup.sh RN: Make retry3 Portable in CI Scripts 2022-09-28 10:57:07 -07:00
bump-oss-version.js Migrate nightly from scheduled workflow to scheduled pipeline (#35977) 2023-01-27 01:33:21 -08:00
compose-source-maps.js
download-kotlin-compiler-with-buck.sh
find-node-for-xcode.sh
generate-api-docs.js
generate-codegen-artifacts.js infra(e2e): rework local E2E script (#34513) 2022-10-04 04:56:44 -07:00
generate-provider-cli.js chore: renamed react-native-codegen to @react-native/codegen (#34804) 2022-11-28 08:28:51 -08:00
generate-specs-cli.js
ios-configure-glog.sh
launchPackager.bat
launchPackager.command
lint-java.js
native_modules.rb
node-binary.sh
objc-test.sh
packager-reporter.js
packager.sh build: allow packager override for PROJECT_ROOT (#35354) 2022-11-17 14:18:09 -08:00
prepare-package-for-release.js Bypass tag check in dry run (#35428) (#35470) 2022-11-25 10:53:14 -08:00
process-podspecs.sh
publish-npm.js fix(scripts): remove leftover code for tmpPublishingFolder (#35528) 2022-12-01 16:38:42 -08:00
react_native_pods.rb fix: pod install with --project-directory (#35754) 2022-12-31 02:42:55 -08:00
react-native-xcode.sh Update react-native-xcode.sh to use PROJECT_DIR from Xcode (#35970) 2023-01-30 04:03:31 -08:00
release-utils.js fix(scripts): remove leftover code for tmpPublishingFolder (#35528) 2022-12-01 16:38:42 -08:00
retry3 RN: Make retry3 Portable in CI Scripts 2022-09-28 10:57:07 -07:00
run_ruby_tests.sh
run-android-ci-instrumentation-tests.js
run-android-emulator.sh
run-android-local-integration-tests.sh
run-android-local-unit-tests.sh
run-ci-e2e-tests.js refactor(scripts): use forEachPackage instead of yarn workspaces info (#35633) 2022-12-14 03:04:06 -08:00
run-ci-javascript-tests.js Fix Errors with TypeScript Tests 2022-12-15 19:17:58 -08:00
run-instrumentation-tests-via-adb-shell.sh
scm-utils.js Do not depend on an ENV variable when publishing and setting the RN version (#34746) 2022-09-22 07:34:50 -07:00
set-rn-template-version.js
set-rn-version.js fix(scripts): add logic for version scripts to account for local E2E test versioning (#35846) 2023-01-18 08:27:11 -08:00
setup-verdaccio.js save registry auth token before bootstrapping verdaccio (#35991) 2023-01-27 11:01:45 -08:00
sync-css-layout.sh
test-e2e-local-clean.js fix(e2e script): backport from 71 fixes to the E2E script (#35477) 2022-11-25 03:26:20 -08:00
test-e2e-local.js fix(scripts): add logic for version scripts to account for local E2E test versioning (#35846) 2023-01-18 08:27:11 -08:00
test-manual-e2e.sh Void the Maven coordinates for react-native and hermes-engine (#35379) 2022-11-18 04:46:16 -08:00
testing-utils.js infra(e2e): rework local E2E script (#34513) 2022-10-04 04:56:44 -07:00
try-n-times.js
update_podfile_lock.sh
update-ruby.sh Read .ruby-version file in Gemfile (#35410) 2022-11-21 05:59:19 -08:00
validate-android-device-env.sh
validate-android-sdk.sh
validate-android-test-env.sh
validate-ios-test-env.sh
version-utils.js fix(scripts): add logic for version scripts to account for local E2E test versioning (#35846) 2023-01-18 08:27:11 -08:00