From 81a6b6ed3c54498f6f2148c106846352405949bf Mon Sep 17 00:00:00 2001 From: Ilia Burdukovski Date: Wed, 25 Sep 2019 17:49:43 -0700 Subject: [PATCH] fix build with hermes on windows (#26556) 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: https://github.com/facebook/react-native/pull/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 --- react.gradle | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/react.gradle b/react.gradle index 14f07461daaed6..29972d1b981cca 100644 --- a/react.gradle +++ b/react.gradle @@ -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,