From 5be50d482082917351b46ee2e339e56e7e34e111 Mon Sep 17 00:00:00 2001 From: Michel dos Santos Kuguio Date: Fri, 25 Jan 2019 03:12:51 -0800 Subject: [PATCH] - update to gradle 4.10.1 or high (#23103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Add suport to gradle 4.10.1 or high! The new version of android studio 3.3 recommendete to update gradle project to 4.10.1 > To take advantage of the latest features, improvements, and security fixes, we strongly recommend that you update the Android Gradle plugin to version 3.3.0 and Gradle to version 4.10.1. [Release notes ](https://developer.android.com/studio/releases/gradle-plugin) >Android plugin 3.2.0 and higher now support building the Android App Bundle—a new upload format that defers APK generation and signing to compatible app stores, such as Google Play. With app bundles, you no longer have to build, sign, and manage multiple APKs, and users get smaller, more optimized downloads. [Learn more](https://developer.android.com/guide/app-bundle/?utm_source=android-studio) but if the upgrade to the new Android gradle many warnings come up, becouse meny things was obsoleted > WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'. > WARNING: API 'variant.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'. > WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'. > It will be removed at the end of 2019. > For more information, [see ](https://d.android.com/r/tools/task-configuration-avoidance.) > To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace. Changelog: ---------- [Android] [Deprecated] - fix warinings obsolete to update to gradle 4.10.1 or high Pull Request resolved: https://github.com/facebook/react-native/pull/23103 Differential Revision: D13817123 Pulled By: cpojer fbshipit-source-id: 9816e20145a5fded2702cf9317cfb6862f3ebd8b --- ReactAndroid/build.gradle | 27 ++++++++++++------------ ReactAndroid/release.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 4 +++- react.gradle | 6 +++--- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index fd03e602cf142c..8798ec968d54d2 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -141,25 +141,26 @@ task downloadJSC(dependsOn: createNativeDepsDirectories, type: Download) { } // Create Android.mk library module based on jsc from npm -task prepareJSC(dependsOn: downloadJSC) << { - def jscTar = tarTree(downloadJSC.dest) - def jscAAR = jscTar.matching({ it.include "**/android-jsc/**/*.aar" }).singleFile - def soFiles = zipTree(jscAAR).matching({ it.include "**/*.so" }) +task prepareJSC(dependsOn: downloadJSC) { + doLast { + def jscTar = tarTree(downloadJSC.dest) + def jscAAR = jscTar.matching({ it.include "**/android-jsc/**/*.aar" }).singleFile + def soFiles = zipTree(jscAAR).matching({ it.include "**/*.so" }) - def headerFiles = jscTar.matching({ it.include "**/include/*.h" }) + def headerFiles = jscTar.matching({ it.include "**/include/*.h" }) - copy { - from soFiles - from headerFiles - from "src/main/jni/third-party/jsc/Android.mk" + copy { + from soFiles + from headerFiles + from "src/main/jni/third-party/jsc/Android.mk" - filesMatching("**/*.h", { it.path = "JavaScriptCore/${it.name}"}) + filesMatching("**/*.h", { it.path = "JavaScriptCore/${it.name}" }) - includeEmptyDirs false - into "$thirdPartyNdkDir/jsc" + includeEmptyDirs false + into "$thirdPartyNdkDir/jsc" + } } } - task downloadNdkBuildDependencies { if (!boostPath) { dependsOn downloadBoost diff --git a/ReactAndroid/release.gradle b/ReactAndroid/release.gradle index 6fba6f20c98c43..a7b8a43b277252 100644 --- a/ReactAndroid/release.gradle +++ b/ReactAndroid/release.gradle @@ -92,8 +92,8 @@ afterEvaluate { project -> android.libraryVariants.all { variant -> def name = variant.name.capitalize() - task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) { - from variant.javaCompile.destinationDir + task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) { + from variant.javaCompileProvider.get().destinationDir } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d76b502e226a5c..c3d272aa60380f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ +#Thu Jan 24 16:45:50 BRST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +android.debug.obsoleteApi=true diff --git a/react.gradle b/react.gradle index f44d369df1b887..57027dd3f8bf34 100644 --- a/react.gradle +++ b/react.gradle @@ -92,11 +92,11 @@ afterEvaluate { } else { variant.registerResGeneratingTask(currentBundleTask) } - variant.mergeResources.dependsOn(currentBundleTask) + variant.mergeResourcesProvider.get().dependsOn(currentBundleTask) // packageApplication for Android plugin 3.x def packageTask = variant.hasProperty("packageApplication") - ? variant.packageApplication + ? variant.packageApplicationProvider.get() : tasks.findByName("package${targetName}") if (variant.hasProperty("packageLibrary")) { packageTask = variant.packageLibrary @@ -149,7 +149,7 @@ afterEvaluate { } // mergeAssets must run first, as it clears the intermediates directory - dependsOn(variant.mergeAssets) + dependsOn(variant.mergeAssetsProvider.get()) enabled currentBundleTask.enabled }