Copy bundled resources and js in Android App Bundle builds (#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: https://github.com/facebook/react-native/pull/21738

Differential Revision: D13669288

Pulled By: cpojer

fbshipit-source-id: 0e985983f04504b69e447dbc1f3f34cf8f4eb927
This commit is contained in:
Edward Karuna 2019-01-15 02:11:11 -08:00 committed by Facebook Github Bot
parent 19d04a312b
commit abfd563b47
1 changed files with 9 additions and 0 deletions

View File

@ -102,6 +102,9 @@ afterEvaluate {
packageTask = variant.packageLibrary
}
// 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(
@ -119,6 +122,9 @@ afterEvaluate {
}
packageTask.dependsOn(currentCopyResTask)
if (buildPreBundleTask != null) {
buildPreBundleTask.dependsOn(currentCopyResTask)
}
}
def currentAssetsCopyTask = tasks.create(
@ -149,5 +155,8 @@ afterEvaluate {
}
packageTask.dependsOn(currentAssetsCopyTask)
if (buildPreBundleTask != null) {
buildPreBundleTask.dependsOn(currentAssetsCopyTask)
}
}
}