Coverage reporting improvements
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 8m48s
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 8m48s
- add coverage to sonar - coverage in domain and commonUI
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import com.android.build.gradle.internal.coverage.JacocoReportTask
|
||||
import com.android.build.gradle.internal.lint.AndroidLintTask
|
||||
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||
import org.sonarqube.gradle.SonarTask
|
||||
|
||||
plugins {
|
||||
// this is necessary to avoid the plugins to be loaded multiple times
|
||||
// in each subproject's classloader
|
||||
alias(libs.plugins.versions)
|
||||
alias(libs.plugins.sonarqube)
|
||||
alias(libs.plugins.android.application) apply false
|
||||
@@ -20,9 +21,31 @@ sonar {
|
||||
properties {
|
||||
property("sonar.projectKey", "YAEP")
|
||||
property("sonar.projectName", "YAEP")
|
||||
|
||||
val reports = subprojects
|
||||
.flatMap { p ->
|
||||
p.tasks.withType<JacocoReportTask>()
|
||||
}
|
||||
.map { t ->
|
||||
"${t.outputReportDir.asFile.get()}/report.xml"
|
||||
}
|
||||
|
||||
property(
|
||||
"sonar.coverage.jacoco.xmlReportPaths",
|
||||
reports
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<SonarTask>().configureEach {
|
||||
dependsOn(
|
||||
subprojects.flatMap { it.tasks.withType<AndroidLintTask>() }
|
||||
)
|
||||
dependsOn(
|
||||
subprojects.flatMap { it.tasks.withType<JacocoReportTask>() }
|
||||
)
|
||||
}
|
||||
|
||||
tasks.withType<KotlinJvmCompile>().configureEach {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.fromTarget(libs.versions.jdk.get()))
|
||||
@@ -41,3 +64,11 @@ fun isNonStable(version: String): Boolean {
|
||||
|| version.contains("beta", ignoreCase = true)
|
||||
|| version.contains("RC", ignoreCase = true)
|
||||
}
|
||||
|
||||
subprojects {
|
||||
tasks.withType<Test> {
|
||||
testLogging {
|
||||
events("passed", "skipped", "failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user