-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[CI] Fix e2e detox build step #24953
Conversation
Manually provide PROJECT_ROOT for RNTester project js bundle build step
ece87d2
to
e608c4c
Compare
Thanks for the PR! I'll update mine and avoid disabling the Detox tests. |
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.
It looks like the Detox e2e tests finished successfully. Thanks for doing this. Could you verify if it would be possible to override the $PROJECT_ROOT envvar when invoking the react-native-xcode.sh
script instead?
outputPaths = ( | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
shellPath = /bin/sh; | ||
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; | ||
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js $SRCROOT/..\n"; |
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.
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js $SRCROOT/..\n"; | |
shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; |
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.
Would this work, in place of adding a second parameter to the script? It would remove the need for $PROJECT_ROOT_OVERRIDE.
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.
Supplying PROJECT_ROOT via env var whilst starting the react-native-xcode.sh
won't override the PROJECT_ROOT var inside the script, as the var is constructed inside the shell script (with no existing logic to accept overrides externally).
react-native/scripts/react-native-xcode.sh
Lines 55 to 60 in fb8a7c3
REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
# The project should be located next to where react-native is installed | |
# in node_modules. | |
PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."} | |
cd "$PROJECT_ROOT" || exit |
I agree with you that supplying the PROJECT_ROOT_OVERRIDE via script arg is not as elegant as supplying it via env var. In the case of the latter approach, the initialization of the script will look something like:
PROJECT_ROOT_OVERRIDE=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js;
If this is workable, i'll go ahead with it 👍
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.
My understanding is it should be overridable. The following line sets PROJECT_ROOT to the current value of PROJECT_ROOT, unless it is not defined, in which case it is set to "$REACT_NATIVE_DIR/../..".
PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."}
I verified that's the case in https://circleci.com/gh/hramos/react-native/5739
. I'll apply those changes and land.
67924c0
to
f8483ee
Compare
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.
@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @nossbigg in adc0878. When will my fix make it into a release? | Upcoming Releases |
Thanks for the merge, @hramos! :) |
Summary: Fixes the e2e detox build step by manually overriding `PROJECT_ROOT` for the project's JS bundle build step. After seeing [quite](facebook#18472 (comment)) [a](facebook#18472 (comment)) [few](facebook#15432 (comment)) [comments](https://stackoverflow.com/a/49506072) suggesting running some variant of the `react-native bundle` manually on your own so as to build the jsbundle required as part of the build step for RNTester project... The main issue I found was that the working directory in which `react-native-xcode.sh` executed the CLI bundle step was not correct. The `PROJECT_ROOT` was not resolving to the root of the `react-native` project directory, but instead to something to the effect of `/Users/gibson.cheng/IdeaProjects/react-native/../..` - of which of course the build step would not be able to find the `react-native` project to run the build against. I'm not sure if new generated `react-native` projects require this manual override, so I only applied it to the RNTester project. Reviewers are welcome to correct my understanding and solutioning to this matter :) hramos, if this works, perhaps there would not be a need to push through with facebook#24936. Also, this contributes to facebook#23561. ## Changelog [Internal] [Fixed] - Fix build-ios-e2e build step Pull Request resolved: facebook#24953 Differential Revision: D15415850 Pulled By: hramos fbshipit-source-id: baaff09f81f01be4da1608e0b2898d037db35c23 (cherry picked from commit adc0878)
Summary: Fixes the e2e detox build step by manually overriding `PROJECT_ROOT` for the project's JS bundle build step. After seeing [quite](facebook#18472 (comment)) [a](facebook#18472 (comment)) [few](facebook#15432 (comment)) [comments](https://stackoverflow.com/a/49506072) suggesting running some variant of the `react-native bundle` manually on your own so as to build the jsbundle required as part of the build step for RNTester project... The main issue I found was that the working directory in which `react-native-xcode.sh` executed the CLI bundle step was not correct. The `PROJECT_ROOT` was not resolving to the root of the `react-native` project directory, but instead to something to the effect of `/Users/gibson.cheng/IdeaProjects/react-native/../..` - of which of course the build step would not be able to find the `react-native` project to run the build against. I'm not sure if new generated `react-native` projects require this manual override, so I only applied it to the RNTester project. Reviewers are welcome to correct my understanding and solutioning to this matter :) hramos, if this works, perhaps there would not be a need to push through with facebook#24936. Also, this contributes to facebook#23561. ## Changelog [Internal] [Fixed] - Fix build-ios-e2e build step Pull Request resolved: facebook#24953 Differential Revision: D15415850 Pulled By: hramos fbshipit-source-id: baaff09f81f01be4da1608e0b2898d037db35c23
Summary
Fixes the e2e detox build step by manually overriding
PROJECT_ROOT
for the project's JS bundle build step.After seeing quite a few comments suggesting running some variant of the
react-native bundle
manually on your own so as to build the jsbundle required as part of the build step for RNTester project...The main issue I found was that the working directory in which
react-native-xcode.sh
executed the CLI bundle step was not correct. ThePROJECT_ROOT
was not resolving to the root of thereact-native
project directory, but instead to something to the effect of/Users/gibson.cheng/IdeaProjects/react-native/../..
- of which of course the build step would not be able to find thereact-native
project to run the build against.I'm not sure if new generated
react-native
projects require this manual override, so I only applied it to the RNTester project. Reviewers are welcome to correct my understanding and solutioning to this matter :)@hramos, if this works, perhaps there would not be a need to push through with #24936. Also, this contributes to #23561.
Changelog
[Internal] [Fixed] - Fix build-ios-e2e build step
Test Plan
build-ios-e2e
should work now