From 7599593b307b71aebe3184233bd9a5f4478b4c88 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Tue, 1 Jun 2021 11:26:16 -0700 Subject: [PATCH] Gradle 6.9, Android Gradle Plugin 4.2.1 (#31593) Summary: Bump Gradle to 6.9 which supports Apple Silicon, also Android Gradle Plugin 4.2.1 which defaults to Java 1.8 so no additional config required. ## Changelog [Android] [Changed] - Bump Gradle to 6.9, Android Gradle Plugin to 4.2.1 Pull Request resolved: https://github.com/facebook/react-native/pull/31593 Test Plan: rn-tester builds and runs as expected Reviewed By: mdvacca Differential Revision: D28711942 Pulled By: ShikaSD fbshipit-source-id: 2a4616cd0f17db7616ab29dea1652717f2cd0f6d --- ReactAndroid/build.gradle | 4 ---- .../src/main/third-party/java/robolectric/{4.4 => }/BUCK | 0 build.gradle.kts | 4 ++-- gradle.properties | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- packages/react-native-codegen/android/build.gradle | 2 +- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- .../android/gradlePlugin-build/gradlePlugin/build.gradle | 2 +- packages/react-native-gradle-plugin/build.gradle.kts | 4 ++-- packages/rn-tester/android/app/build.gradle | 5 +---- template/android/app/build.gradle | 5 ----- template/android/build.gradle | 2 +- template/android/gradle/wrapper/gradle-wrapper.properties | 2 +- tools/build_defs/oss/rn_defs.bzl | 4 ++-- 14 files changed, 14 insertions(+), 25 deletions(-) rename ReactAndroid/src/main/third-party/java/robolectric/{4.4 => }/BUCK (100%) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index ee51e20d245488..ceeb44c1b2e431 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -380,10 +380,6 @@ task extractJNIFiles { android { compileSdkVersion 30 ndkVersion ANDROID_NDK_VERSION - compileOptions { - sourceCompatibility(JavaVersion.VERSION_1_8) - targetCompatibility(JavaVersion.VERSION_1_8) - } defaultConfig { minSdkVersion(21) diff --git a/ReactAndroid/src/main/third-party/java/robolectric/4.4/BUCK b/ReactAndroid/src/main/third-party/java/robolectric/BUCK similarity index 100% rename from ReactAndroid/src/main/third-party/java/robolectric/4.4/BUCK rename to ReactAndroid/src/main/third-party/java/robolectric/BUCK diff --git a/build.gradle.kts b/build.gradle.kts index 42289d9ec80349..abb4545d012232 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,8 +17,8 @@ buildscript { } } dependencies { - classpath("com.android.tools.build:gradle:4.1.0") - classpath("de.undercouch:gradle-download-task:4.0.2") + classpath("com.android.tools.build:gradle:4.2.1") + classpath("de.undercouch:gradle-download-task:4.1.1") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index dd6698ad75bd27..0edb7925961a4c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,3 +5,4 @@ org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError org.gradle.parallel=true ANDROID_NDK_VERSION=20.1.5948944 +android.useAndroidX=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8cf6eb5ad222e3..7665b0fa93ae75 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-codegen/android/build.gradle b/packages/react-native-codegen/android/build.gradle index b4b890df72d91b..06b18ac7454d7e 100644 --- a/packages/react-native-codegen/android/build.gradle +++ b/packages/react-native-codegen/android/build.gradle @@ -19,7 +19,7 @@ buildscript { } } dependencies { - classpath("com.android.tools.build:gradle:4.1.0") + classpath("com.android.tools.build:gradle:4.2.1") } } diff --git a/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties index 14e30f7416a55e..7665b0fa93ae75 100644 --- a/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/build.gradle b/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/build.gradle index 5efb793d69f8a5..4d91d9968d2dd1 100644 --- a/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/build.gradle +++ b/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/build.gradle @@ -19,7 +19,7 @@ gradlePlugin { } dependencies { - implementation 'com.android.tools.build:gradle:4.1.0' + implementation 'com.android.tools.build:gradle:4.2.1' // Use the same Gson version that `com.android.tools.build:gradle` depends on. implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.google.guava:guava:29.0-jre' diff --git a/packages/react-native-gradle-plugin/build.gradle.kts b/packages/react-native-gradle-plugin/build.gradle.kts index 3c1a47a49bb682..dedcf4f9eb880e 100644 --- a/packages/react-native-gradle-plugin/build.gradle.kts +++ b/packages/react-native-gradle-plugin/build.gradle.kts @@ -8,7 +8,7 @@ plugins { `java-gradle-plugin` `kotlin-dsl` - kotlin("jvm") version "1.4.21" + kotlin("jvm") version "1.4.20" } repositories { @@ -26,5 +26,5 @@ gradlePlugin { } dependencies { - implementation("com.android.tools.build:gradle:4.1.0") + implementation("com.android.tools.build:gradle:4.2.1") } diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index 3af20011187745..6597a0ecdf0f4b 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -131,10 +131,7 @@ def useIntlJsc = false android { compileSdkVersion 29 ndkVersion ANDROID_NDK_VERSION - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } + dexOptions { javaMaxHeapSize "4g" } diff --git a/template/android/app/build.gradle b/template/android/app/build.gradle index f75c160968e7eb..3e76ea0e075e8b 100644 --- a/template/android/app/build.gradle +++ b/template/android/app/build.gradle @@ -125,11 +125,6 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - defaultConfig { applicationId "com.helloworld" minSdkVersion rootProject.ext.minSdkVersion diff --git a/template/android/build.gradle b/template/android/build.gradle index ac4d64714c0bfb..95d0ed393e086a 100644 --- a/template/android/build.gradle +++ b/template/android/build.gradle @@ -13,7 +13,7 @@ buildscript { jcenter() } dependencies { - classpath("com.android.tools.build:gradle:4.1.0") + classpath("com.android.tools.build:gradle:4.2.1") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/template/android/gradle/wrapper/gradle-wrapper.properties b/template/android/gradle/wrapper/gradle-wrapper.properties index 8cf6eb5ad222e3..7665b0fa93ae75 100644 --- a/template/android/gradle/wrapper/gradle-wrapper.properties +++ b/template/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/tools/build_defs/oss/rn_defs.bzl b/tools/build_defs/oss/rn_defs.bzl index 515f938b239beb..86d6f4cf28ac33 100644 --- a/tools/build_defs/oss/rn_defs.bzl +++ b/tools/build_defs/oss/rn_defs.bzl @@ -216,8 +216,8 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs): "-XX:+UseConcMarkSweepGC", # required by -XX:+CMSClassUnloadingEnabled "-XX:+CMSClassUnloadingEnabled", "-XX:ReservedCodeCacheSize=150M", - "-Drobolectric.dependency.dir=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4", - "-Dlibraries=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4/*.jar", + "-Drobolectric.dependency.dir=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric", + "-Dlibraries=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/*.jar", "-Drobolectric.logging.enabled=true", "-XX:MaxPermSize=620m", "-Drobolectric.offline=true",