fix(hermes): change logic in build scripts for Apple to use the right version#34710
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.
Same as above. Do we always have MAC_DEPLOYMENT_TARGET?
| 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.
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.
good catch, I guess we need to modify the CircleCI config to set them up too, right?
There was a problem hiding this comment.
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. |
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
There was a problem hiding this comment.
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.
You are right! I have full path too... I'm updating the PR to use the env variable.
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 |
Summary
Within the
hermes-engine.podspeccontained in the RN repo (atreact-native/main/sdks/hermes-engine/), there's a bit of logic that triggers./utils/build-ios-framework.shand./utils/build-mac-framework.sh.The issue is that we all thought that that
./utils/build-ios-framework.shwould invoke the React native version of the scripts (since the podspec file lives right next to theutilsfolder) but, in reality, it doesn't. It just so happens that the Hermes repo has a root levelutilsfolder 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-*.shscripts.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.