react-native-macos/packages/react-native-gradle-plugin
JoseLion 7fcdb9d9d8 fix(android): Append `.exe` to hermesc binary path for Windows users (#34151)
Summary:
Resolves https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/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
2022-08-04 08:33:16 -07:00
..
gradle/wrapper Bump Gradle to 7.5.0 (#34310) 2022-08-01 06:31:18 -07:00
src fix(android): Append `.exe` to hermesc binary path for Windows users (#34151) 2022-08-04 08:33:16 -07:00
BUCK Create @fb-tools-support/yarn package 2022-01-28 08:22:17 -08:00
README.md Add a README before publishing this package 2021-09-27 09:23:33 -07:00
build.gradle.kts Bump AGP from 7.2.0 to 7.2.1 (#34166) 2022-07-12 03:57:14 -07:00
gradlew bump gradle to 7.3 (#32588) 2021-11-15 06:47:39 -08:00
gradlew.bat Re-sync with internal repository (#32212) 2021-09-15 10:45:06 +01:00
package.json Bump dependencies version number 2022-07-27 08:19:11 -07:00
settings.gradle.kts Format .kts files with ktfmt 2022-06-09 02:50:45 -07:00

README.md

react-native-gradle-plugin

Version

A Gradle Plugin used to support development of React Native applications for Android.

Installation

yarn add react-native-gradle-plugin

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like