Commit 568bcb34 authored by MozLando's avatar MozLando
Browse files

Merge #7036

7036: For #7034: Task configuration avoidance improvements r=NotWoods a=grigoryk

Some low-hanging fruit for https://github.com/mozilla-mobile/android-components/issues/7034





Co-authored-by: default avatarGrisha Kruglov <gkruglov@mozilla.com>
parents 9be66907 47234b1a
Loading
Loading
Loading
Loading
+10 −18
Original line number Diff line number Diff line
@@ -92,15 +92,6 @@ subprojects {
    }

    project.configurations.all {
        // Robolectric, through `com.google.android.apps.common.testing.accessibility.framework`
        // depends on an old version of protobuf that conflict with the Application Services one.
        // See:
        // - https://github.com/mozilla/application-services/issues/2952
        // - https://github.com/google/tink/issues/282
        // - https://github.com/robolectric/robolectric/issues/2643
        // The good news is the next version of Robolectric will not depend on this lib anymore.
        // (https://github.com/robolectric/robolectric/pull/5547)
        all*.exclude group: 'com.google.protobuf', module: 'protobuf-java'
        // Enforce that all (transitive) dependencies are using the same support library version as we do.
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
@@ -123,7 +114,7 @@ subprojects {
            }

            // Format test output
            tasks.matching {it instanceof Test}.all {
            tasks.matching {it instanceof Test}.configureEach() {
                systemProperty "robolectric.logging", "stdout"
                systemProperty "logging.test-mode", "true"

@@ -203,13 +194,13 @@ subprojects {
            }

            if (project.hasProperty("coverage") && project.name != "support-test") {
                tasks.withType(Test) {
                tasks.withType(Test).configureEach() {
                    jacoco.includeNoLocationClasses = true

                    finalizedBy jacocoTestReport
                }

                task jacocoTestReport(type: JacocoReport) {
                tasks.register("jacocoTestReport", JacocoReport) {
                    reports {
                        xml.enabled = true
                        html.enabled = true
@@ -242,7 +233,7 @@ subprojects {

evaluationDependsOnChildren()

task docs(type: org.jetbrains.dokka.gradle.DokkaAndroidTask, overwrite: true) {
tasks.register("docs", org.jetbrains.dokka.gradle.DokkaAndroidTask) {
    moduleName = "$rootProject.name"
    outputDirectory = "$buildDir/javadoc"
    outputFormat = "gfm"
@@ -277,7 +268,7 @@ task docs(type: org.jetbrains.dokka.gradle.DokkaAndroidTask, overwrite: true) {
    })
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

@@ -297,7 +288,7 @@ detekt {
    }
}

tasks.withType(io.gitlab.arturbosch.detekt.Detekt) {
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach() {
    // Custom detekt rules should be build before
    // See https://arturbosch.github.io/detekt/extensions.html#pitfalls
    dependsOn(":tooling-detekt:assemble")
@@ -315,7 +306,7 @@ tasks.withType(io.gitlab.arturbosch.detekt.Detekt) {
}

// Apply same path exclusions as for the main task
tasks.withType(io.gitlab.arturbosch.detekt.DetektCreateBaselineTask) {
tasks.withType(io.gitlab.arturbosch.detekt.DetektCreateBaselineTask).configureEach() {
    exclude "**/src/androidTest/**"
    exclude "**/src/test/**"
    exclude "**/test/src/**"
@@ -335,7 +326,8 @@ dependencies {
    detektPlugins project(":tooling-detekt")
}

task ktlint(type: JavaExec, group: "verification") {
tasks.register("ktlint", JavaExec) {
    group = "verification"
    description = "Check Kotlin code style."
    classpath = configurations.ktlint
    main = "com.github.shyiko.ktlint.Main"
@@ -346,7 +338,7 @@ apply plugin: GVVersionVerifierPlugin
apply plugin: GitHubPlugin


task listRepositories {
tasks.register("listRepositories") {
    doLast {
        println "Repositories:"
        project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ configurations {
    // correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
    // Success!
    jnaForTest
    // Robolectric, through `com.google.android.apps.common.testing.accessibility.framework`
    // depends on an old version of protobuf that conflict with the Application Services one.
    // See: https://github.com/mozilla/application-services/issues/2952
    all*.exclude group: 'com.google.protobuf', module: 'protobuf-java'
}

dependencies {
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ preBuild.finalizedBy("generateComponentEnum")
/**
 * Generates a "Components" enum listing all published components.
 */
task generateComponentEnum {
tasks.register("generateComponentEnum") {
    doLast {
        generatedSrcDir.mkdirs()

+2 −2
Original line number Diff line number Diff line
@@ -17,14 +17,14 @@ dependencies {
    testImplementation Dependencies.tools_detekt_test
}

task lintRelease {
tasks.register("lintRelease") {
    doLast {
        // Do nothing. We execute the same set of tasks for all our modules in parallel on taskcluster.
        // This project doesn't have a lint task.
    }
}

task assembleAndroidTest {
tasks.register("assembleAndroidTest") {
    doLast {
        // Do nothing. Like the `lint` task above this is just a dummy task so that this module
        // behaves like our others and we do not need to special case it in automation.
+5 −5
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

task sourcesJar(type: Jar) {
tasks.register("sourcesJar", Jar) {
    classifier = 'sources'
    from sourceSets.main.allSource
}
@@ -73,7 +73,7 @@ publishing {
    }
}

task lintRelease {
tasks.register("lintRelease") {
  doLast {
    // Do nothing. We execute the same set of tasks for all our modules in parallel on taskcluster.
    // This project doesn't have a lint task. To avoid special casing our automation I just added
@@ -81,21 +81,21 @@ task lintRelease {
  }
}

task assembleAndroidTest {
tasks.register("assembleAndroidTest") {
  doLast {
    // Do nothing. Like the `lint` task above this is just a dummy task so that this module
    // behaves like our others and we do not need to special case it in automation.
  }
}

task assembleRelease {
tasks.register("assembleRelease") {
  doLast {
    // Do nothing. Like the `lint` task above this is just a dummy task so that this module
    // behaves like our others and we do not need to special case it in automation.
  }
}

task testRelease {
tasks.register("testRelease") {
  doLast {
    // Do nothing. Like the `lint` task above this is just a dummy task so that this module
    // behaves like our others and we do not need to special case it in automation.
Loading