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 facebook-github-bot committed Oct 2, 2018
1 parent 8a49750 commit ff084a4
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 @@ -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") {

This comment has been minimized.

Copy link
@jwhiddent3

jwhiddent3 Oct 29, 2018

I believe that this should be "merged_assets/${targetName}/merge${targetName}Assets/out", as targetPath produces a second folder (e.g. for variant devRelease, you'd have devRelease and dev/release). While I think that it's more consistent to be dev/release, gradle creates it as devRelease for the other assets like fonts and such.

This comment has been minimized.

Copy link
@ikesyo

ikesyo Oct 30, 2018

Contributor

See #21782.

from jsBundleDir
}
}

// mergeAssets must run first, as it clears the intermediates directory
dependsOn(variant.mergeAssets)
Expand Down

0 comments on commit ff084a4

Please sign in to comment.