-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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(hermes): change logic in build scripts for Apple to use the right version #34710
Conversation
Code looks fine on my end 👍 @cipolleschi has more context than me on this change |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
} | ||
|
||
function get_mac_deployment_target { | ||
ruby -rcocoapods-core -rjson -e "puts Pod::Specification.from_file('hermes-engine.podspec').deployment_target('osx')" |
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.
Same as above. Do we always have MAC_DEPLOYMENT_TARGET
?
@@ -16,15 +16,15 @@ REACT_NATIVE_PATH=${REACT_NATIVE_PATH:-$PWD/../..} | |||
JSI_PATH="$REACT_NATIVE_PATH/ReactCommon/jsi" | |||
|
|||
function get_release_version { | |||
ruby -rcocoapods-core -rjson -e "puts Pod::Specification.from_file('hermes-engine.podspec').version" |
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.
Are we sure that in CI, where we invoke the build-ios-framework
and the build-mac-framework
we have the RELEASE_VERSION
, IOS_DEPLOYMENT_TARGET
and MAC_DEPLOYMENT_TARGET
properly set?
In this case we are not going through the hermes-engine.podspec
, so it could be that these variables are not set...
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.
good catch, I guess we need to modify the CircleCI config to set them up too, right?
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.
thanks for following up the change. when i first proposed the change, i just want to keep it shorter. ideally we could add some if/else check.
for example,
function get_release_version {
if [[ -n "${RELEASE_VERSION}" ]]; then
echo "${RELEASE_VERSION}"
else
ruby -rcocoapods-core -rjson -e "puts Pod::Specification.from_file('hermes-engine.podspec').deployment_target('ios')"
fi
}
or
function get_release_version {
if [[ -z "${RELEASE_VERSION}" ]]; then
echo "RELEASE_VERSION is not defined."
exit 1
fi
echo "${RELEASE_VERSION}"
}
please feel free to change the code that makes sense to you.
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
nit changes 😅
1ed907f
to
33e19a9
Compare
Thanks @Kudo, I should have fixed those! :D |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
2 similar comments
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Base commit: 5d2a400 |
Base commit: 5d2a400 |
db71a89
to
d7a4c14
Compare
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
d7a4c14
to
39f4cba
Compare
|
||
# Set HERMES_OVERRIDE_HERMESC_PATH if pre-built HermesC is available | ||
#{File.exist?(import_hermesc_file) ? "export HERMES_OVERRIDE_HERMESC_PATH=#{import_hermesc_file}" : ""} | ||
#{File.exist?(import_hermesc_file) ? "echo \"Overriding HermesC path...\"" : ""} | ||
|
||
# Build iOS framework | ||
./utils/build-ios-framework.sh | ||
#{hermes_utils_path}/build-ios-framework.sh |
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.
could you double confirm the generated Pods/Local Podspecs/hermes-engine.podspec.json doesn't contain the absolute path? in my case, it will have /Users/kudo
, e.g.
"prepare_command": "export BUILD_TYPE=Debug\nexport RELEASE_VERSION=\"1000.0.0\"\nexport IOS_DEPLOYMENT_TARGET=\"12.4\"\nexport MAC_DEPLOYMENT_TARGET=\"10.13\"\nexport JSI_PATH=\"/Users/kudo/react-native/sdks/hermes/../../ReactCommon/jsi\"\n\n# Set HERMES_OVERRIDE_HERMESC_PATH if pre-built HermesC is available\n\n\n\n# Build iOS framework\n/Users/kudo/react-native/sdks/hermes/../../sdks/hermes-engine/utils/build-ios-framework.sh\n\n# Build Mac framework\n/Users/kudo/react-native/sdks/hermes/../../sdks/hermes-engine/utils/build-mac-framework.sh"
that would make the checksum in Podfile.lock unstable between each environments. that's why previously i proposed environment variables approach.
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.
You are right! I have full path too... I'm updating the PR to use the env variable.
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 good now, thanks @cipolleschi!
39f4cba
to
72e3ebe
Compare
Co-authored-by: Riccardo <cipolleschi@fb.com>
Co-authored-by: Riccardo <cipolleschi@fb.com>
Co-authored-by: Riccardo <cipolleschi@fb.com>
Co-authored-by: Riccardo <cipolleschi@fb.com>
Co-authored-by: Riccardo <cipolleschi@fb.com>
3683fa7
to
37985a2
Compare
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
37985a2
to
7c41d4e
Compare
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @kelset in cc13b02. When will my fix make it into a release? | Upcoming Releases |
… version (facebook#34710) Summary: Within the `hermes-engine.podspec` contained in the RN repo (at `react-native/main/sdks/hermes-engine/`), there's a bit of logic that triggers `./utils/build-ios-framework.sh` and `./utils/build-mac-framework.sh` . The issue is that we all thought that that `./utils/build-ios-framework.sh` would invoke the React native version of the scripts (since the podspec file lives right next to the `utils` folder) but, in reality, it doesn't. It just so happens that the Hermes repo has a root level `utils` folder which is (you guessed it) where the Hermes variation of those build scripts live. So, when running the pod install command in a react-native project (build from source), it will go and download the hermes source code (since the `source[:git]` gets set) but then it will use the **hermes** variation of the `build-*.sh` scripts. [Read more here](facebook#34513 (comment)). This PR is taking kudo's proposed [patch here](reactwg/react-native-new-architecture#68 (reply in thread)) - props for the fix go to him. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [iOS] [Fixed] - Change hermes logic in build scripts for Apple to use the correct files Pull Request resolved: facebook#34710 Test Plan: Tested by kudo in his work, and in my PR locally - [see here](facebook#34513 (comment)). Reviewed By: cortinico Differential Revision: D39647057 Pulled By: cipolleschi fbshipit-source-id: 6520e248801a307ca2f8886a3853dd1ff4af193d
Summary
Within the
hermes-engine.podspec
contained in the RN repo (atreact-native/main/sdks/hermes-engine/
), there's a bit of logic that triggers./utils/build-ios-framework.sh
and./utils/build-mac-framework.sh
.The issue is that we all thought that that
./utils/build-ios-framework.sh
would invoke the React native version of the scripts (since the podspec file lives right next to theutils
folder) but, in reality, it doesn't. It just so happens that the Hermes repo has a root levelutils
folder which is (you guessed it) where the Hermes variation of those build scripts live.So, when running the pod install command in a react-native project (build from source), it will go and download the hermes source code (since the
source[:git]
gets set) but then it will use the hermes variation of thebuild-*.sh
scripts.Read more here.
This PR is taking @Kudo's proposed patch here - props for the fix go to him.
Changelog
[iOS] [Fixed] - Change hermes logic in build scripts for Apple to use the correct files
Test Plan
Tested by @Kudo in his work, and in my PR locally - see here.