From 19ec74eaaa09bdbbe885248b005d398085033a21 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 6 Oct 2023 11:03:14 -0700 Subject: [PATCH 1/3] Un-bump AGP to 8.1.2 Summary: I'm reverting the change of AGP from 8.2 beta to 8.1 as we don't need 8.2 Using 8.2 beta forces us to use Android Studio beta, which is actually not necessary. Changelog: [Android] [Changed] - Bump AGP to 8.1.2 Differential Revision: D50016572 fbshipit-source-id: 3d17079b21c967c4ced39e067f511a89f52c58b1 --- packages/react-native/gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/gradle/libs.versions.toml b/packages/react-native/gradle/libs.versions.toml index 0aee78ce3d93a7..5a71347d3b113e 100644 --- a/packages/react-native/gradle/libs.versions.toml +++ b/packages/react-native/gradle/libs.versions.toml @@ -5,7 +5,7 @@ targetSdk = "34" compileSdk = "34" buildTools = "34.0.0" # Dependencies versions -agp = "8.2.0-beta06" +agp = "8.1.2" androidx-annotation = "1.6.0" androidx-appcompat = "1.6.1" androidx-autofill = "1.1.0" From c799ee5cfe57a36c8a8f2ede0f40e70289d0ed88 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 6 Oct 2023 11:03:14 -0700 Subject: [PATCH 2/3] Bump Gradle to 8.4 Summary: This is our usual round of bumps just after the branch cut. Changelog: [Android] [Changed] - Bump Gradle to 8.4 Differential Revision: D50016574 fbshipit-source-id: d86bb071afc8afcb98cdba12e266f7d45e5ef6cd --- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 17 +++++++++-------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- packages/react-native-gradle-plugin/gradlew | 14 +++++++------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- packages/react-native/template/android/gradlew | 14 +++++++------- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d11cdd907dd9dc..8838ba97ba0914 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-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca147c0cd..1aa94a42690741 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/packages/react-native-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-gradle-plugin/gradle/wrapper/gradle-wrapper.properties index d11cdd907dd9dc..8838ba97ba0914 100644 --- a/packages/react-native-gradle-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-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-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/packages/react-native-gradle-plugin/gradlew b/packages/react-native-gradle-plugin/gradlew index 0adc8e1a53214b..1aa94a42690741 100755 --- a/packages/react-native-gradle-plugin/gradlew +++ b/packages/react-native-gradle-plugin/gradlew @@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/packages/react-native/template/android/gradle/wrapper/gradle-wrapper.properties b/packages/react-native/template/android/gradle/wrapper/gradle-wrapper.properties index d11cdd907dd9dc..8838ba97ba0914 100644 --- a/packages/react-native/template/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native/template/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/packages/react-native/template/android/gradlew b/packages/react-native/template/android/gradlew index 0adc8e1a53214b..1aa94a42690741 100755 --- a/packages/react-native/template/android/gradlew +++ b/packages/react-native/template/android/gradlew @@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ From 4c76b993fa62e98a22329c1a824a3021f5c108cf Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 6 Oct 2023 11:03:32 -0700 Subject: [PATCH 3/3] Fix compilation warnings introduced by Gradle 8.4 (#39959) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39959 We're still accessing project.buildDir which will be removed in Gradle 9.0 I'm cleaning it up here. Changelog: [Internal] [Changed] - Fix compilation warnings introduced by Gradle 8.4 Reviewed By: yungsters Differential Revision: D50016573 fbshipit-source-id: da026a56838a5d863a1a01cf710c0a06af4e0acf --- packages/react-native-gradle-plugin/build.gradle.kts | 1 + .../src/main/kotlin/com/facebook/react/TaskConfiguration.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/react-native-gradle-plugin/build.gradle.kts b/packages/react-native-gradle-plugin/build.gradle.kts index 8934f0f30ba3e4..c4a31beb010e19 100644 --- a/packages/react-native-gradle-plugin/build.gradle.kts +++ b/packages/react-native-gradle-plugin/build.gradle.kts @@ -66,6 +66,7 @@ tasks.withType().configureEach { apiVersion = "1.5" // See comment above on JDK 11 support jvmTarget = "11" + allWarningsAsErrors = true } } diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt index ed5551d0987f3f..e839e5c37ba3b7 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt @@ -23,6 +23,7 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio val targetName = variant.name.capitalizeCompat() val targetPath = variant.name + val buildDir = this.layout.buildDirectory.get().asFile // Resources: generated/assets/react//index.android.bundle val resourcesDir = File(buildDir, "generated/res/react/$targetPath") // Bundle: generated/assets/react//index.android.bundle