Skip to content

Commit

Permalink
fix build with hermes on windows (#26556)
Browse files Browse the repository at this point in the history
Summary:
On the Windows platform, with hermes-engine enabled, the assembly crashes with an error:
![image](https://user-images.githubusercontent.com/8634793/65568495-ab11d980-df8c-11e9-83a0-2a2d26447860.png)
The problem lies in calling hermes command without the leading arguments `"cmd", "/c"` ([react.gradle, line: 152](https://github.com/facebook/react-native/blob/e028ac7af2d5b48860f01055f3bbacf91f6b6956/react.gradle#L152) )

## Changelog

[General] [Fixed] - Added a platform check and running commandLine with the corresponding arguments
Pull Request resolved: #26556

Test Plan:
Under Windows, enable hermes-engine in _build.gradle_ and run the `gradlew assembleRelease` or `gradlew bundleRelease` command
Also check assembly on other available platforms

Differential Revision: D17587023

Pulled By: cpojer

fbshipit-source-id: bab10213b23fac5ab6a46ac4929759dcd43e39c2
  • Loading branch information
B27 authored and facebook-github-bot committed Sep 26, 2019
1 parent f0bcfbe commit 81a6b6e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion react.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ afterEvaluate {
hermesFlags = config.hermesFlagsDebug
if (hermesFlags == null) hermesFlags = []
}
commandLine(getHermesCommand(), "-emit-binary", "-out", hbcTempFile, jsBundleFile, *hermesFlags)

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine("cmd", "/c", getHermesCommand(), "-emit-binary", "-out", hbcTempFile, jsBundleFile, *hermesFlags)
} else {
commandLine(getHermesCommand(), "-emit-binary", "-out", hbcTempFile, jsBundleFile, *hermesFlags)
}
}
ant.move(
file: hbcTempFile,
Expand Down

0 comments on commit 81a6b6e

Please sign in to comment.