Skip to content

Commit

Permalink
Add workaround for Android Gradle Plugin 3.2 change to asset dir (fac…
Browse files Browse the repository at this point in the history
…ebook#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 facebook#21132
Fixes facebook#18357
Pull Request resolved: facebook#21409

Differential Revision: D10141860

Pulled By: hramos

fbshipit-source-id: 0fb20fcec67ec2bfd7a8d9052599bbc70464b466
  • Loading branch information
edilaic authored and KusStar committed Nov 11, 2020
1 parent be3edba commit 2a780e1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions react.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,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)
Expand Down

0 comments on commit 2a780e1

Please sign in to comment.