Skip to content

Commit

Permalink
- update to gradle 4.10.1 or high (#23103)
Browse files Browse the repository at this point in the history
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: #23103

Differential Revision: D13817123

Pulled By: cpojer

fbshipit-source-id: 9816e20145a5fded2702cf9317cfb6862f3ebd8b
  • Loading branch information
misaku authored and facebook-github-bot committed Jan 25, 2019
1 parent 1024dc2 commit 5be50d4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
27 changes: 14 additions & 13 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ReactAndroid/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions react.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 5be50d4

Please sign in to comment.