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

RNGP - Bump AGP to 7.4.1 #36039

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Expand Up @@ -33,7 +33,7 @@ buildscript {
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.android.tools.build:gradle:7.4.1")
classpath("de.undercouch:gradle-download-task:5.0.1")
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-gradle-plugin/build.gradle.kts
Expand Up @@ -33,7 +33,7 @@ group = "com.facebook.react"

dependencies {
implementation(gradleApi())
implementation("com.android.tools.build:gradle:7.3.1")
implementation("com.android.tools.build:gradle:7.4.1")
implementation("com.google.code.gson:gson:2.8.9")
implementation("com.google.guava:guava:31.0.1-jre")
implementation("com.squareup:javapoet:1.13.0")
Expand Down
Expand Up @@ -8,7 +8,6 @@
package com.facebook.react

import com.android.build.api.variant.AndroidComponentsExtension
import com.android.build.gradle.AppExtension
import com.android.build.gradle.internal.tasks.factory.dependsOn
import com.facebook.react.tasks.BuildCodegenCLITask
import com.facebook.react.tasks.GenerateCodegenArtifactsTask
Expand Down Expand Up @@ -55,24 +54,6 @@ class ReactPlugin : Plugin<Project> {
project.configureReactTasks(variant = variant, config = extension)
}
}

// This is a legacy AGP api. Needed as AGP 7.3 is not consuming generated resources correctly.
// Can be removed as we bump to AGP 7.4 stable.
// 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 { 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
Expand Up @@ -72,9 +72,7 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio
it.hermesFlags.set(config.hermesFlags)
it.reactNativeDir.set(config.reactNativeDir)
}
// Currently broken inside AGP 7.3 We need to wait for a release of AGP 7.4 in order to use
// the addGeneratedSourceDirectory API.
// variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir)
variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir)
variant.sources.assets?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::jsBundleDir)
}
}
2 changes: 1 addition & 1 deletion template/android/build.gradle
Expand Up @@ -15,7 +15,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}