Skip to content

Commit

Permalink
Add workaround for Android Gradle Plugin 3.2 change to asset dir (#21409
Browse files Browse the repository at this point in the history
)

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: #21409

Differential Revision: D10141860

Pulled By: hramos

fbshipit-source-id: 0fb20fcec67ec2bfd7a8d9052599bbc70464b466
  • Loading branch information
edilaic authored and grabbou committed Oct 2, 2018
1 parent b7ba225 commit a4fed6e
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 a4fed6e

Please sign in to comment.