From e820c8ca184798649e367f66f15dbc9d9ef31a32 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 26 Oct 2017 11:00:36 -0700 Subject: [PATCH] Bug 1411654 - Part 1: Upgrade to Android-Gradle 3.0+ and build-tools;26.0.2. r=maliu New Android-Gradle plugins pin the build-tools version, and we want to be consistent between Gradle and moz.build. MozReview-Commit-ID: ApWS4rHzPuH --HG-- extra : rebase_source : 5a5730b4b9ce84af40a7c73c4f1abba017103f02 --- build.gradle | 3 +- gradle/wrapper/gradle-wrapper.properties | 4 +- mobile/android/app/build.gradle | 85 +++++++------------ .../app/src/photon/res/values/styles.xml | 4 +- mobile/android/base/Makefile.in | 2 +- mobile/android/geckoview/build.gradle | 10 +-- mobile/android/geckoview_example/build.gradle | 16 ++-- mobile/android/gradle.configure | 41 +++++++-- .../android/gradle/with_gecko_binaries.gradle | 72 +++++++++------- mobile/android/thirdparty/build.gradle | 12 +-- old-configure.in | 2 +- python/mozboot/mozboot/android-packages.txt | 2 +- .../misc/android-gradle-dependencies/after.sh | 2 +- 13 files changed, 131 insertions(+), 124 deletions(-) diff --git a/build.gradle b/build.gradle index d39a6c271bab..1b9a1e598682 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,6 @@ allprojects { topobjdir = gradle.mozconfig.topobjdir compileSdkVersion = tryInt(mozconfig.substs.ANDROID_COMPILE_SDK_VERSION) - buildToolsVersion = tryInt(mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION) targetSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK) minSdkVersion = tryInt(mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION) manifestPlaceholders = [ @@ -52,7 +51,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.0.0' // Provided in tree. classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bfd67896af13..8d366b57c92f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip -distributionSha256Sum=ed7e9c8bb41bd10d4c9339c95b2f8b122f5bf13188bd90504a26e0f00b123b0d +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionSha256Sum=5c07b3bac2209fbc98fb1fdf6fd831f72429cdf8c503807404eae03d8c8099e5 diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle index 67f59443f69f..248cb32cc86a 100644 --- a/mobile/android/app/build.gradle +++ b/mobile/android/app/build.gradle @@ -11,7 +11,6 @@ dexcount { android { compileSdkVersion project.ext.compileSdkVersion - buildToolsVersion project.ext.buildToolsVersion defaultConfig { targetSdkVersion project.ext.targetSdkVersion @@ -237,30 +236,31 @@ android { } dependencies { - compile "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" - compile "com.android.support:appcompat-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" - compile "com.android.support:cardview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" - compile "com.android.support:recyclerview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" - compile "com.android.support:design:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" - compile "com.android.support:customtabs:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.android.support:appcompat-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.android.support:cardview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.android.support:recyclerview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.android.support:design:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.android.support:customtabs:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" if (mozconfig.substs.MOZ_NATIVE_DEVICES) { - compile "com.android.support:mediarouter-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" - compile "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" - compile "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" - compile "com.google.android.gms:play-services-cast:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.android.support:mediarouter-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}" + implementation "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-cast:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" } if (mozconfig.substs.MOZ_INSTALL_TRACKING) { - compile "com.google.android.gms:play-services-analytics:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" - compile "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-analytics:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" } if (mozconfig.substs.MOZ_ANDROID_GCM) { - compile "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" - compile "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" - compile "com.google.android.gms:play-services-gcm:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" - compile "com.google.android.gms:play-services-measurement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-gcm:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" + implementation "com.google.android.gms:play-services-measurement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}" } // Include LeakCanary in most gradle based builds. LeakCanary adds about 5k methods, so we disable @@ -269,40 +269,22 @@ dependencies { // of this library. // It doesn't seem like there is a non-trivial way to be conditional on 'localOld', so instead we explicitly // define a version of leakcanary for every flavor: - localCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1' - localOldCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' - officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' - officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' - testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' + localImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1' + localOldImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' + officialImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' + officialImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' + testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' - // With a simple "compile", Gradle will always build these libraries in their default configuration - // (i.e. release), so we need to explicitly forward our own build configuration here (bug 1385695). - // - // Official builds compile a hacked up app:Official..Debug, but need the - // release versions of the dependencies, in order to not have debugging - // information. It's not yet possible to specify just officialDebug, so we - // hack around it here. - if (mozconfig.substs.MOZILLA_OFFICIAL) { - debugCompile project(path: ':geckoview', configuration: "release") - } else { - debugCompile project(path: ':geckoview', configuration: "debug") - } - releaseCompile project(path: ':geckoview', configuration: "release") + implementation project(path: ':geckoview') + implementation project(path: ':thirdparty') - if (mozconfig.substs.MOZILLA_OFFICIAL) { - debugCompile project(path: ':thirdparty', configuration: "release") - } else { - debugCompile project(path: ':thirdparty', configuration: "debug") - } - releaseCompile project(path: ':thirdparty', configuration: "release") - - testCompile 'junit:junit:4.12' - testCompile 'org.robolectric:robolectric:3.1.2' - testCompile 'org.simpleframework:simple-http:6.0.1' - testCompile 'org.mockito:mockito-core:1.10.19' + testImplementation 'junit:junit:4.12' + testImplementation 'org.robolectric:robolectric:3.1.2' + testImplementation 'org.simpleframework:simple-http:6.0.1' + testImplementation 'org.mockito:mockito-core:1.10.19' // Including the Robotium JAR directly can cause issues with dexing. - androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.5.4' + androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.5.4' } // TODO: (bug 1261486): This impl is not robust - @@ -379,7 +361,7 @@ android.applicationVariants.all { variant -> } android.applicationVariants.all { variant -> - configureVariantWithJNIWrappers(variant, "Fennec") + configureApplicationVariantWithJNIWrappers(variant, "Fennec") } if (gradle.startParameter.taskNames.any { it.endsWith('UnitTest') }) { @@ -416,7 +398,7 @@ android.applicationVariants.all { variant -> reports { html.enabled = true // HTML reports for humans. - html.destination = "$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.html" + html.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.html") xml.enabled = false } } @@ -440,7 +422,7 @@ android.applicationVariants.all { variant -> reports { xml.enabled = true // XML reports for machines. - xml.destination = "$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.xml" + xml.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.xml") html.enabled = false } } @@ -466,8 +448,7 @@ android.applicationVariants.all { variant -> variant.outputs.each { output -> output.processManifest.doLast { - [output.processManifest.manifestOutputFile, - output.processManifest.instantRunManifestOutputFile, + [file("${manifestOutputDirectory}/AndroidManifest.xml"), ].each({ File manifestOutFile -> if (manifestOutFile.exists()) { def contents = manifestOutFile.getText('UTF-8') diff --git a/mobile/android/app/src/photon/res/values/styles.xml b/mobile/android/app/src/photon/res/values/styles.xml index f3032693ee84..a3b585570186 100644 --- a/mobile/android/app/src/photon/res/values/styles.xml +++ b/mobile/android/app/src/photon/res/values/styles.xml @@ -579,8 +579,8 @@