fix(android): Append .exe to hermesc binary path for Windows users#34151
fix(android): Append .exe to hermesc binary path for Windows users#34151JoseLion wants to merge 3 commits intofacebook:mainfrom
.exe to hermesc binary path for Windows users#34151Conversation
|
Hi @JoseLion! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
.gitignore
Outdated
| # Visual studio | ||
| .vscode | ||
| .vs | ||
| bin/ |
There was a problem hiding this comment.
Added this line because vscode-java extension creates this folder on Java projects 🙂
There was a problem hiding this comment.
I have the same problem. Still I won't add bin/ here (I added it in my global .gitignore).
The problem is on VS Code's end, as they used a folder name which is too generic and potentially used in production. This has the risk of accidentally make us skip artifacts during NPM packaging or git commits.
Base commit: c37f719 |
.gitignore
Outdated
| # Visual studio | ||
| .vscode | ||
| .vs | ||
| bin/ |
There was a problem hiding this comment.
I have the same problem. Still I won't add bin/ here (I added it in my global .gitignore).
The problem is on VS Code's end, as they used a folder name which is too generic and potentially used in production. This has the risk of accidentally make us skip artifacts during NPM packaging or git commits.
| } | ||
| } | ||
|
|
||
| def hermescBin = Os.isFamily(Os.FAMILY_WINDOWS) ? 'hermesc.exe' : 'hermesc' |
There was a problem hiding this comment.
Great stuff. Can I ask you to do the same logic here:
There was a problem hiding this comment.
Sure! Thanks for the review BTW 🙂
There was a problem hiding this comment.
Done! I took a slightly different approach since the Kotlin was a bit different, but it's still the same concept 😁
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Base commit: c37f719 |
|
@philIip has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
cortinico
left a comment
There was a problem hiding this comment.
Sorry this took longer. This can be merged 👍
I've also added tests which will appear in the final commit
|
This pull request was successfully merged by @JoseLion in 7fcdb9d. When will my fix make it into a release? | Upcoming Releases |
…34151) Summary: Resolves #34116. In a nutshell, the problem was a missing `.exe` extension on the `hermesc` binary path when running on Windows OS. The missing extension causes the method `.exists()` of the File instance to always return false, so none of the conditions ever met and an error was thrown whenever a release build with Hermes enabled was run on Windows. More details can be found in the comments on the above issues. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fix error of release builds with Hermes enabled for Windows users Pull Request resolved: #34151 Test Plan: ### Reproduce Changes on Gradle scrips are better tested on an actual application. To reproduce the issue you can: 1. Create or reuse a React Native application with version `v0.69.1` on a Windows machine 2. Enable Hermes on Android following the steps on the [documentation](https://reactnative.dev/docs/hermes#enabling-hermes) 3. Clean the build folder: `cd android && ./gradlew clean` 4. Bundle the JS and assets for a release version: `./gradlew bundleReleaseJsAndAssets` 5. The build fails with the following error: ```shell Execution failed for task ':app:bundleReleaseJsAndAssets'. > java.lang.Exception: Couldn't determine Hermesc location. Please set `project.ext.react.hermesCommand` to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc ``` ### Test the changes Follow the same steps above using the fix on this PR and the error should disappear 🙂 Reviewed By: NickGerleman Differential Revision: D37755468 Pulled By: cortinico fbshipit-source-id: 2ad0ced583555b907259df116f64a45da6d153f3
…acebook#34151) Summary: Resolves facebook#34116. In a nutshell, the problem was a missing `.exe` extension on the `hermesc` binary path when running on Windows OS. The missing extension causes the method `.exists()` of the File instance to always return false, so none of the conditions ever met and an error was thrown whenever a release build with Hermes enabled was run on Windows. More details can be found in the comments on the above issues. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fix error of release builds with Hermes enabled for Windows users Pull Request resolved: facebook#34151 Test Plan: ### Reproduce Changes on Gradle scrips are better tested on an actual application. To reproduce the issue you can: 1. Create or reuse a React Native application with version `v0.69.1` on a Windows machine 2. Enable Hermes on Android following the steps on the [documentation](https://reactnative.dev/docs/hermes#enabling-hermes) 3. Clean the build folder: `cd android && ./gradlew clean` 4. Bundle the JS and assets for a release version: `./gradlew bundleReleaseJsAndAssets` 5. The build fails with the following error: ```shell Execution failed for task ':app:bundleReleaseJsAndAssets'. > java.lang.Exception: Couldn't determine Hermesc location. Please set `project.ext.react.hermesCommand` to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc ``` ### Test the changes Follow the same steps above using the fix on this PR and the error should disappear 🙂 Reviewed By: NickGerleman Differential Revision: D37755468 Pulled By: cortinico fbshipit-source-id: 2ad0ced583555b907259df116f64a45da6d153f3
Summary
Resolves #34116.
In a nutshell, the problem was a missing
.exeextension on thehermescbinary path when running on Windows OS. The missing extension causes the method.exists()of the File instance to always return false, so none of the conditions ever met and an error was thrown whenever a release build with Hermes enabled was run on Windows. More details can be found in the comments on the above issues.Changelog
[Android] [Fixed] - Fix error of release builds with Hermes enabled for Windows users
Test Plan
Reproduce
Changes on Gradle scrips are better tested on an actual application. To reproduce the issue you can:
v0.69.1on a Windows machinecd android && ./gradlew clean./gradlew bundleReleaseJsAndAssetsTest the changes
Follow the same steps above using the fix on this PR and the error should disappear 🙂