diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37f78a6af837..dbc3ce4a040f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/packages/gradle-plugin/gradle/libs.versions.toml b/packages/gradle-plugin/gradle/libs.versions.toml index c7502fcefd98..9922e5575473 100644 --- a/packages/gradle-plugin/gradle/libs.versions.toml +++ b/packages/gradle-plugin/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] -agp = "8.12.0" +agp = "9.1.0" gson = "2.8.9" guava = "31.0.1-jre" javapoet = "1.13.0" junit = "4.13.2" -kotlin = "2.1.20" +kotlin = "2.3.0" assertj = "3.25.1" ktfmt = "0.22.0" diff --git a/packages/gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/packages/gradle-plugin/gradle/wrapper/gradle-wrapper.properties index 37f78a6af837..dbc3ce4a040f 100644 --- a/packages/gradle-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/packages/gradle-plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts b/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts index 85dadeba0c42..8f3b931b8e43 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts +++ b/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts @@ -64,7 +64,7 @@ kotlin { jvmToolchain(17) } tasks.withType().configureEach { compilerOptions { - apiVersion.set(KotlinVersion.KOTLIN_1_8) + apiVersion.set(KotlinVersion.KOTLIN_2_3) // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt index e7859ff6ad0b..9440eee3f3fe 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt @@ -234,12 +234,12 @@ class ReactPlugin : Plugin { if (isLibrary) { project.extensions.getByType(LibraryAndroidComponentsExtension::class.java).finalizeDsl { ext -> - ext.sourceSets.getByName("main").java.srcDir(generatedSrcDir.get().dir("java").asFile) + ext.sourceSets.getByName("main").java.directories.add(generatedSrcDir.get().dir("java").asFile.absolutePath) } } else { project.extensions.getByType(ApplicationAndroidComponentsExtension::class.java).finalizeDsl { ext -> - ext.sourceSets.getByName("main").java.srcDir(generatedSrcDir.get().dir("java").asFile) + ext.sourceSets.getByName("main").java.directories.add(generatedSrcDir.get().dir("java").asFile.absolutePath) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt index c4a7b359d542..75e917261b3b 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt @@ -9,7 +9,6 @@ package com.facebook.react.utils import com.android.build.api.variant.ApplicationAndroidComponentsExtension import com.android.build.api.variant.LibraryAndroidComponentsExtension -import com.android.build.gradle.LibraryExtension import com.facebook.react.ReactExtension import com.facebook.react.utils.ProjectUtils.isEdgeToEdgeEnabled import com.facebook.react.utils.ProjectUtils.isHermesEnabled @@ -82,7 +81,7 @@ internal object AgpConfiguratorUtils { subproject.pluginManager.withPlugin("com.android.library") { subproject.extensions .getByType(LibraryAndroidComponentsExtension::class.java) - .finalizeDsl { ext -> ext.buildFeatures.buildConfig = true } + .finalizeDsl { ext -> ext.buildFeatures { buildConfig = true } } } } } @@ -114,22 +113,22 @@ internal object AgpConfiguratorUtils { fun configureNamespaceForLibraries(appProject: Project) { appProject.rootProject.allprojects { subproject -> subproject.pluginManager.withPlugin("com.android.library") { - subproject.extensions + val components = subproject.extensions .getByType(LibraryAndroidComponentsExtension::class.java) - .finalizeDsl { ext -> - if (ext.namespace == null) { - val android = subproject.extensions.getByType(LibraryExtension::class.java) - val manifestFile = android.sourceSets.getByName("main").manifest.srcFile - - manifestFile - .takeIf { it.exists() } - ?.let { file -> - getPackageNameFromManifest(file)?.let { packageName -> - ext.namespace = packageName - } - } - } - } + + components.finalizeDsl { dsl -> + if (dsl.namespace.isNullOrEmpty()) { + val manifestFile = subproject.file("src/main/AndroidManifest.xml") + + manifestFile + .takeIf { it.exists() } + ?.let { file -> + getPackageNameFromManifest(file)?.let { packageName -> + dsl.namespace = packageName + } + } + } + } } } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt index 119c80de03c6..6374a357ddfb 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt @@ -20,10 +20,6 @@ internal object NdkConfiguratorUtils { project.pluginManager.withPlugin("com.android.application") { project.extensions.getByType(ApplicationAndroidComponentsExtension::class.java).finalizeDsl { ext -> - // We enable prefab so users can consume .so/headers from ReactAndroid and hermes-engine - // .aar - ext.buildFeatures.prefab = true - // If the user has not provided a CmakeLists.txt path, let's provide // the default one from the framework if (ext.externalNativeBuild.cmake.path == null) { diff --git a/packages/gradle-plugin/settings-plugin/build.gradle.kts b/packages/gradle-plugin/settings-plugin/build.gradle.kts index 2fbeafd502c9..165bf38a8665 100644 --- a/packages/gradle-plugin/settings-plugin/build.gradle.kts +++ b/packages/gradle-plugin/settings-plugin/build.gradle.kts @@ -54,7 +54,7 @@ kotlin { jvmToolchain(17) } tasks.withType().configureEach { compilerOptions { - apiVersion.set(KotlinVersion.KOTLIN_1_8) + apiVersion.set(KotlinVersion.KOTLIN_2_3) // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( diff --git a/packages/gradle-plugin/shared-testutil/build.gradle.kts b/packages/gradle-plugin/shared-testutil/build.gradle.kts index 26173fb55578..19dd3a1333df 100644 --- a/packages/gradle-plugin/shared-testutil/build.gradle.kts +++ b/packages/gradle-plugin/shared-testutil/build.gradle.kts @@ -27,7 +27,7 @@ kotlin { jvmToolchain(17) } tasks.withType().configureEach { compilerOptions { - apiVersion.set(KotlinVersion.KOTLIN_1_8) + apiVersion.set(KotlinVersion.KOTLIN_2_3) // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( diff --git a/packages/gradle-plugin/shared/build.gradle.kts b/packages/gradle-plugin/shared/build.gradle.kts index 315984875ad8..87fb331634ed 100644 --- a/packages/gradle-plugin/shared/build.gradle.kts +++ b/packages/gradle-plugin/shared/build.gradle.kts @@ -33,7 +33,7 @@ kotlin { jvmToolchain(17) } tasks.withType().configureEach { compilerOptions { - apiVersion.set(KotlinVersion.KOTLIN_1_8) + apiVersion.set(KotlinVersion.KOTLIN_2_3) // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( diff --git a/private/helloworld/android/gradle/wrapper/gradle-wrapper.properties b/private/helloworld/android/gradle/wrapper/gradle-wrapper.properties index 37f78a6af837..dbc3ce4a040f 100644 --- a/private/helloworld/android/gradle/wrapper/gradle-wrapper.properties +++ b/private/helloworld/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME