From 4ba192d7f9d8014f1d8c66176012856dbac33070 Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Tue, 19 May 2020 19:26:28 -0700 Subject: [PATCH] [components] For https://github.com/mozilla-mobile/android-components/issues/7034: lazily register clean/detekt/ktlint/coverage tasks --- mobile/android/android-components/build.gradle | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mobile/android/android-components/build.gradle b/mobile/android/android-components/build.gradle index 3b497efa5391..797201fc1023 100644 --- a/mobile/android/android-components/build.gradle +++ b/mobile/android/android-components/build.gradle @@ -203,13 +203,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 @@ -277,7 +277,7 @@ task docs(type: org.jetbrains.dokka.gradle.DokkaAndroidTask, overwrite: true) { }) } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } @@ -297,7 +297,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 +315,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 +335,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 +347,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 } -- 2.11.4.GIT