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
This commit is contained in:
DengYun 2015-11-18 12:17:39 -08:00 committed by facebook-github-bot-0
parent ea636c94e3
commit 6124298dd7
1 changed files with 14 additions and 2 deletions

View File

@ -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
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
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
}