Skip to content

Commit

Permalink
Copy bundled resources and js in Android App Bundle builds (facebook#…
Browse files Browse the repository at this point in the history
…21738)

Summary:
Android App Bundle builds use the packageBundle and bundle tasks instead
of the package and assemble tasks the APK builds use. Because of this,
the resources and js bundles weren't getting copied into the final
artifact. In an App Bundle build, the merged assets must be present
during the buildPreBundle step in order to arrive in the App Bundle.
Pull Request resolved: facebook#21738

Differential Revision: D13669288

Pulled By: cpojer

fbshipit-source-id: 0e985983f04504b69e447dbc1f3f34cf8f4eb927
  • Loading branch information
edilaic authored and evgeni-wix committed Feb 4, 2019
1 parent f10eb0d commit 5aeb812
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions react.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ afterEvaluate {
? variant.packageApplication
: tasks.findByName("package${targetName}")

// pre bundle build task for Android plugin 3.2+
def buildPreBundleTask = tasks.findByName("build${targetName}PreBundle")

def resourcesDirConfigValue = config."resourcesDir${targetName}"
if (resourcesDirConfigValue) {
def currentCopyResTask = tasks.create(
Expand All @@ -109,6 +112,9 @@ afterEvaluate {
}

packageTask.dependsOn(currentCopyResTask)
if (buildPreBundleTask != null) {
buildPreBundleTask.dependsOn(currentCopyResTask)
}
}

def currentAssetsCopyTask = tasks.create(
Expand Down Expand Up @@ -139,5 +145,8 @@ afterEvaluate {
}

packageTask.dependsOn(currentAssetsCopyTask)
if (buildPreBundleTask != null) {
buildPreBundleTask.dependsOn(currentAssetsCopyTask)
}
}
}

0 comments on commit 5aeb812

Please sign in to comment.