Commit de8452c4 authored by Agi Sferro's avatar Agi Sferro
Browse files

Bug 1571288 - Fix gradle warnings about obsolete APIs. r=nalexander

Differential Revision: https://phabricator.services.mozilla.com/D41440

--HG--
extra : moz-landing-system : lando
parent 25488b08
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ buildscript {
        }
    }

    ext.kotlin_version = '1.3.10'
    ext.kotlin_version = '1.3.41'
    ext.support_library_version = '28.0.0'
    ext.jacoco_version = '0.8.1'
    ext.lifecycle_library_version = '1.1.1'
@@ -83,7 +83,7 @@ buildscript {
    }

    dependencies {
        classpath 'org.mozilla.apilint:apilint:0.2.5'
        classpath 'org.mozilla.apilint:apilint:0.2.6'
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
        classpath 'org.apache.commons:commons-exec:1.3'
+7 −6
Original line number Diff line number Diff line
@@ -366,8 +366,9 @@ android.applicationVariants.all { variant ->
    // the main sourceSet without losing the stub, so we cover all the
    // configurations here.
    android.sourceSets."${variant.name}".manifest.srcFile "${rewriteManifestPackage.destinationDir}/AndroidManifest.xml"
    variant.preBuild.dependsOn rewriteManifestPackage

    variant.preBuildProvider.configure {
        dependsOn rewriteManifestPackage
    }

    // Local (read, not 'official') builds want to reflect developer changes to
    // AndroidManifest.xml.in, strings.xml, and preprocessed Java code.  To do
@@ -430,8 +431,8 @@ android.applicationVariants.all { variant ->
                               // the issues with medium/low priority we can lower the report level here.

        classes = files(bundleJar)
        source = variant.javaCompile.source
        classpath = variant.javaCompile.classpath + files(android.bootClasspath)
        source = variant.javaCompileProvider.get().source
        classpath = variant.javaCompileProvider.get().classpath + files(android.bootClasspath)

        excludeFilter = file("findbugs-exclude.xml")
        dependsOn jarTask
@@ -456,8 +457,8 @@ android.applicationVariants.all { variant ->
                               // the issues with medium/low priority we can lower the report level here.
        
        classes = files(bundleJar)
        source = variant.javaCompile.source
        classpath = variant.javaCompile.classpath + files(android.bootClasspath)
        source = variant.javaCompileProvider.get().source
        classpath = variant.javaCompileProvider.get().classpath + files(android.bootClasspath)

        excludeFilter = file("findbugs-exclude.xml")
        dependsOn jarTask
+15 −13
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ android.libraryVariants.all { variant ->
        description = "Generate Javadoc for build variant $name"
        destinationDir = new File(destinationDir, variant.baseName)
        doFirst {
            classpath = files(variant.javaCompile.classpath.files)
            classpath = files(variant.javaCompileProvider.get().classpath.files)
        }

        source = variant.sourceSets.collect({ it.java.srcDirs })
@@ -268,8 +268,8 @@ android.libraryVariants.all { variant ->
        include 'org/mozilla/geckoview/**.java'
        options.addPathOption('sourcepath', ':').setValue(
            variant.sourceSets.collect({ it.java.srcDirs }).flatten() +
            variant.generateBuildConfig.sourceOutputDir +
            variant.aidlCompile.sourceOutputDir)
            variant.generateBuildConfigProvider.get().sourceOutputDir +
            variant.aidlCompileProvider.get().sourceOutputDir)

        // javadoc 8 has a bug that requires the rt.jar file from the JRE to be
        // in the bootclasspath (https://stackoverflow.com/a/30458820).
@@ -308,11 +308,11 @@ android.libraryVariants.all { variant ->
        classifier 'sources'
        description = "Generate Javadoc for build variant $name"
        destinationDir = new File(destinationDir, variant.baseName)
        from files(variant.javaCompile.source)
        from files(variant.javaCompileProvider.get().source)
    }

    task("checkstyle${name.capitalize()}", type: Checkstyle) {
        classpath = variant.javaCompile.classpath
        classpath = variant.javaCompileProvider.get().classpath
        configFile file("checkstyle.xml")
        // TODO: cleanup and include all sources
        source = ['src/main/java/']
@@ -327,15 +327,17 @@ android.libraryVariants.all { variant ->
}

android.libraryVariants.all { variant ->
    // At this point, the Android-Gradle plugin has created all the Android tasks and
    // configurations.  This is the time for us to declare additional Glean files to package into
    // AAR files.  This packs `metrics.yaml` in the root of the AAR, sibling to
    // `AndroidManifest.xml` and `classes.jar`.  By default, consumers of the AAR will ignore this
    // file, but consumers that look for it can find it (provided GeckoView is a `module()`
    // dependency and not a `project()` dependency.)  Under the hood this uses that the
    // `packageLibrary` task is a Maven `Zip` task, and we can simply extend its inputs.  See
    // At this point, the Android-Gradle plugin has created all the Android
    // tasks and configurations.  This is the time for us to declare additional
    // Glean files to package into AAR files.  This packs `metrics.yaml` in the
    // root of the AAR, sibling to `AndroidManifest.xml` and `classes.jar`.  By
    // default, consumers of the AAR will ignore this file, but consumers that
    // look for it can find it (provided GeckoView is a `module()` dependency
    // and not a `project()` dependency.)  Under the hood this uses that the
    // task provided by `packageLibraryProvider` task is a Maven `Zip` task,
    // and we can simply extend its inputs.  See
    // https://android.googlesource.com/platform/tools/base/+/0cbe8846f7d02c0bb6f07156b9f4fde16d96d329/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/BundleAar.kt#94.
    variant.packageLibrary.from("${topsrcdir}/toolkit/components/telemetry/geckoview/streaming/metrics.yaml")
    variant.packageLibraryProvider.get().from("${topsrcdir}/toolkit/components/telemetry/geckoview/streaming/metrics.yaml")
}

apply plugin: 'maven-publish'
+1 −1
Original line number Diff line number Diff line
@@ -12,6 +12,6 @@ ext.configureVariantDebugLevel = { variant ->
    // that is quite large: roughly 500kb for Fennec.  Therefore we remove
    // 'vars' unless we're producing a debug build, where it is useful.
    if (!'debug'.equals(buildType) || mozconfig.substs.MOZILLA_OFFICIAL) {
        variant.javaCompile.options.debugOptions.debugLevel = 'lines,source'
        variant.javaCompileProvider.get().options.debugOptions.debugLevel = 'lines,source'
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -103,9 +103,9 @@ ext.configureLibraryVariantWithJNIWrappers = { variant, module ->
            // Configure the classpath at evaluation-time, not at
            // configuration-time: see above comment.
            doFirst {
                classpath variant.javaCompile.classpath
                classpath variant.javaCompileProvider.get().classpath
                // Include android.jar.
                classpath variant.javaCompile.options.bootstrapClasspath
                classpath variant.javaCompileProvider.get().options.bootstrapClasspath
            }
    
            main = 'org.mozilla.gecko.annotationProcessors.AnnotationProcessor'
@@ -152,9 +152,9 @@ ext.configureApplicationVariantWithJNIWrappers = { variant, module ->
            // Configure the classpath at evaluation-time, not at
            // configuration-time: see above comment.
            doFirst {
                classpath variant.javaCompile.classpath
                classpath variant.javaCompileProvider.get().classpath
                // Include android.jar.
                classpath variant.javaCompile.options.bootstrapClasspath
                classpath variant.javaCompileProvider.get().options.bootstrapClasspath
            }
        
            main = 'org.mozilla.gecko.annotationProcessors.AnnotationProcessor'