Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for resources not correctly bundlded on release appbundles #35872

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ class ReactPlugin : Plugin<Project> {
// This registers the $buildDir/generated/res/react/<variant> folder as a
// res folder to be consumed with the old AGP Apis which are not broken.
project.extensions.getByType(AppExtension::class.java).apply {
this.applicationVariants.all {
it.registerGeneratedResFolders(
project.layout.buildDirectory.files("generated/res/react/${it.name}"))
this.applicationVariants.all { variant ->
val isDebuggableVariant =
extension.debuggableVariants.get().any { it.equals(variant.name, ignoreCase = true) }
val targetName = variant.name.replaceFirstChar { it.uppercase() }
val bundleTaskName = "createBundle${targetName}JsAndAssets"
if (!isDebuggableVariant) {
variant.registerGeneratedResFolders(
project.layout.buildDirectory.files("generated/res/react/${variant.name}"))
variant.mergeResourcesProvider.get().dependsOn(bundleTaskName)
}
}
}
configureCodegen(project, extension, isLibrary = false)
Expand Down