From 6124298dd7c555c0c913defc5c927b592a368ead Mon Sep 17 00:00:00 2001 From: DengYun Date: Wed, 18 Nov 2015 12:17:39 -0800 Subject: [PATCH] bugfix part 1 for #4124: react.gradle cause a error on windows when building release apk. Summary: ``` * What went wrong: Execution failed for task ':app:bundleReleaseJsAndAssets'. > A problem occurred starting process 'command 'react-native'' ``` Can be solved by this patch. Closes https://github.com/facebook/react-native/pull/4209 Reviewed By: svcscm Differential Revision: D2669661 Pulled By: foghina fb-gh-sync-id: 951b7eb9dd3121de607cf5eb3dfb3af44cdf5994 --- .../templates/src/app/react.gradle | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/local-cli/generator-android/templates/src/app/react.gradle b/local-cli/generator-android/templates/src/app/react.gradle index dc18bb9a0..1e08b00f1 100644 --- a/local-cli/generator-android/templates/src/app/react.gradle +++ b/local-cli/generator-android/templates/src/app/react.gradle @@ -1,3 +1,5 @@ +import org.apache.tools.ant.taskdefs.condition.Os + def config = project.hasProperty("react") ? project.react : []; def bundleAssetName = config.bundleAssetName ?: "index.android.bundle" @@ -36,8 +38,13 @@ task bundleDebugJsAndAssets(type: Exec) { // set up the call to the react-native cli workingDir reactRoot - commandLine "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug + } else { + commandLine "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", + entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug + } enabled config.bundleInDebug ?: false } @@ -56,8 +63,13 @@ task bundleReleaseJsAndAssets(type: Exec) { // set up the call to the react-native cli workingDir reactRoot - commandLine "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine "cmd","/c", "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease + } else { + commandLine "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", + entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease + } enabled config.bundleInRelease ?: true }