mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-13 18:11:22 +08:00
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:
committed by
Richard Hua
parent
7572ddca61
commit
294b46cb0f
@@ -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
|
||||
|
||||
@@ -16,7 +16,15 @@ var TEMP_FILE_PATH = path.join(require("os").tmpdir(), "CodePushResourcesMap.jso
|
||||
var resourcesDir = process.argv[2];
|
||||
var resourceFiles = [];
|
||||
|
||||
getFilesInFolder(resourcesDir, resourceFiles);
|
||||
try {
|
||||
getFilesInFolder(resourcesDir, resourceFiles);
|
||||
} catch(error) {
|
||||
var targetPathNotFoundExceptionMessage = "\nResources directory path does not exist.\n";
|
||||
targetPathNotFoundExceptionMessage += "Unable to find '" + resourcesDir;
|
||||
targetPathNotFoundExceptionMessage += "' directory. Please check version of Android Plugin for Gradle.";
|
||||
error.message += targetPathNotFoundExceptionMessage;
|
||||
throw error;
|
||||
}
|
||||
|
||||
var fileToModifiedTimeMap = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user