Skip to content

Commit 5647d79

Browse files
cortinicofacebook-github-bot
authored andcommittedFeb 2, 2023
RNGP - Bump AGP to 7.4.1 (#36039)
Summary: Pull Request resolved: #36039 This change bumps AGP to 7.4.1 so we can remove a lot of the unnecessary changes we had to do to support AGP 7.3.x I've also removed the explicit version in the template as now the AGP version is provided by RNGP. That means that the user will get the correct version they need. This also bumps the default CMake version in user space to 3.22 which resolves a lot of warning when users are building with the New Architecture enabled. Changelog: [Android] [Changed] - Bump AGP to 7.4.1 allow-large-files Reviewed By: cipolleschi Differential Revision: D42960353 fbshipit-source-id: 9065f975c1694d266a86b2d3fe805e6e2b1c4aa1
1 parent 6d45e49 commit 5647d79

File tree

6 files changed

+14
-25
lines changed

6 files changed

+14
-25
lines changed
 

‎build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ buildscript {
3333
gradlePluginPortal()
3434
}
3535
dependencies {
36-
classpath("com.android.tools.build:gradle:7.3.1")
36+
classpath("com.android.tools.build:gradle:7.4.1")
3737
classpath("de.undercouch:gradle-download-task:5.0.1")
3838
}
3939
}

‎packages/react-native-gradle-plugin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ group = "com.facebook.react"
3333

3434
dependencies {
3535
implementation(gradleApi())
36-
implementation("com.android.tools.build:gradle:7.3.1")
36+
implementation("com.android.tools.build:gradle:7.4.1")
3737
implementation("com.google.code.gson:gson:2.8.9")
3838
implementation("com.google.guava:guava:31.0.1-jre")
3939
implementation("com.squareup:javapoet:1.13.0")

‎packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package com.facebook.react
99

1010
import com.android.build.api.variant.AndroidComponentsExtension
11-
import com.android.build.gradle.AppExtension
1211
import com.android.build.gradle.internal.tasks.factory.dependsOn
1312
import com.facebook.react.tasks.BuildCodegenCLITask
1413
import com.facebook.react.tasks.GenerateCodegenArtifactsTask
@@ -55,24 +54,6 @@ class ReactPlugin : Plugin<Project> {
5554
project.configureReactTasks(variant = variant, config = extension)
5655
}
5756
}
58-
59-
// This is a legacy AGP api. Needed as AGP 7.3 is not consuming generated resources correctly.
60-
// Can be removed as we bump to AGP 7.4 stable.
61-
// This registers the $buildDir/generated/res/react/<variant> folder as a
62-
// res folder to be consumed with the old AGP Apis which are not broken.
63-
project.extensions.getByType(AppExtension::class.java).apply {
64-
this.applicationVariants.all { variant ->
65-
val isDebuggableVariant =
66-
extension.debuggableVariants.get().any { it.equals(variant.name, ignoreCase = true) }
67-
val targetName = variant.name.replaceFirstChar { it.uppercase() }
68-
val bundleTaskName = "createBundle${targetName}JsAndAssets"
69-
if (!isDebuggableVariant) {
70-
variant.registerGeneratedResFolders(
71-
project.layout.buildDirectory.files("generated/res/react/${variant.name}"))
72-
variant.mergeResourcesProvider.get().dependsOn(bundleTaskName)
73-
}
74-
}
75-
}
7657
configureCodegen(project, extension, isLibrary = false)
7758
}
7859

‎packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio
7272
it.hermesFlags.set(config.hermesFlags)
7373
it.reactNativeDir.set(config.reactNativeDir)
7474
}
75-
// Currently broken inside AGP 7.3 We need to wait for a release of AGP 7.4 in order to use
76-
// the addGeneratedSourceDirectory API.
77-
// variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir)
75+
variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir)
7876
variant.sources.assets?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::jsBundleDir)
7977
}
8078
}

‎packages/rn-tester/android/app/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ def enableProguardInReleaseBuilds = true
7777
*/
7878
def jscFlavor = 'org.webkit:android-jsc:+'
7979

80+
/**
81+
* This allows to customized the CMake version used for compiling RN Tester.
82+
*/
83+
def cmakeVersion = project(":ReactAndroid").cmake_version
84+
8085
/**
8186
* Architectures to build native code for.
8287
*/
@@ -128,6 +133,11 @@ android {
128133
keyPassword MYAPP_RELEASE_KEY_PASSWORD
129134
}
130135
}
136+
externalNativeBuild {
137+
cmake {
138+
version cmakeVersion
139+
}
140+
}
131141
splits {
132142
abi {
133143
enable enableSeparateBuildPerCPUArchitecture

‎template/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
mavenCentral()
1616
}
1717
dependencies {
18-
classpath("com.android.tools.build:gradle:7.3.1")
18+
classpath("com.android.tools.build:gradle")
1919
classpath("com.facebook.react:react-native-gradle-plugin")
2020
}
2121
}

0 commit comments

Comments
 (0)