Add workaround for Android Gradle Plugin 3.2 change to asset dir (#21409)

Summary:
Android Gradle Plugin 3.2 uses a new intermediates/merged_assets directory instead of intermediates/assets. This workaround copies the javascript bundle to both directories for compatibility purposes.

Fixes #21132
Fixes #18357
Pull Request resolved: https://github.com/facebook/react-native/pull/21409

Differential Revision: D10141860

Pulled By: hramos

fbshipit-source-id: 0fb20fcec67ec2bfd7a8d9052599bbc70464b466
This commit is contained in:
Edward Karuna 2018-10-02 02:55:40 -07:00 committed by Facebook Github Bot
parent 8a4975051e
commit ff084a4e80
1 changed files with 14 additions and 3 deletions

View File

@ -122,9 +122,20 @@ afterEvaluate {
group = "react"
description = "copy bundled JS into ${targetName}."
from jsBundleDir
into file(config."jsBundleDir${targetName}" ?:
"$buildDir/intermediates/assets/${targetPath}")
if (config."jsBundleDir${targetName}") {
from jsBundleDir
into file(config."jsBundleDir${targetName}")
} else {
into ("$buildDir/intermediates")
into ("assets/${targetPath}") {
from jsBundleDir
}
// Workaround for Android Gradle Plugin 3.2+ new asset directory
into ("merged_assets/${targetPath}/merge${targetName}Assets/out") {
from jsBundleDir
}
}
// mergeAssets must run first, as it clears the intermediates directory
dependsOn(variant.mergeAssets)