Support build for 'Android Plugin for Gradle' versions lower than 1.3.0 (#651)

In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
'$buildDir' has slightly different structure - 'merged' folder
does not exists so '${targetPath}' folder contains directly in 'res' folder.

Fix issue https://github.com/Microsoft/react-native-code-push/issues/584
This commit is contained in:
Sergey Akhalkov
2017-01-19 04:10:30 +03:00
committed by Richard Hua
parent 7572ddca61
commit 294b46cb0f
2 changed files with 17 additions and 1 deletions

View File

@@ -40,6 +40,14 @@ gradle.projectsEvaluated {
def resourcesDirConfigName = "jsBundleDir${targetName}"
def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?:
file("$buildDir/intermediates/res/merged/${targetPath}")
// In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
// '$buildDir' has slightly different structure - 'merged' folder
// does not exists so '${targetPath}' folder contains directly in 'res' folder.
if (!resourcesDir.exists() && file("$buildDir/intermediates/res/${targetPath}").exists()) {
resourcesDir = file("$buildDir/intermediates/res/${targetPath}")
}
def jsBundleFile = file("$jsBundleDir/$bundleAssetName")
// Make this task run right before the bundle task