chore: カバレッジの計測方法を命令網羅に変更

This commit is contained in:
usbharu 2024-09-15 23:11:29 +09:00
parent 0801216a0d
commit 884d17cf47
Signed by: usbharu
GPG Key ID: 95CBCF7046307B77
1 changed files with 37 additions and 45 deletions

View File

@ -19,6 +19,7 @@ import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.importer.DependencyDataImporter import com.github.jk1.license.importer.DependencyDataImporter
import com.github.jk1.license.importer.XmlReportImporter import com.github.jk1.license.importer.XmlReportImporter
import com.github.jk1.license.render.* import com.github.jk1.license.render.*
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
@ -37,19 +38,6 @@ apply {
group = "dev.usbharu" group = "dev.usbharu"
version = "0.0.1" version = "0.0.1"
tasks.withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.naming/javax.naming=ALL-UNNAMED",
"--add-opens", "java.base/java.util.concurrent.locks=ALL-UNNAMED"
).toMutableList()
}
}
kotlin { kotlin {
jvmToolchain(21) jvmToolchain(21)
compilerOptions { compilerOptions {
@ -85,8 +73,7 @@ repositories {
} }
val os = org.gradle.nativeplatform.platform.internal val os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem()
.DefaultNativePlatform.getCurrentOperatingSystem()
dependencies { dependencies {
developmentOnly(libs.h2db) developmentOnly(libs.h2db)
@ -173,35 +160,40 @@ configurations {
} }
} }
tasks {
//tasks{ withType<io.gitlab.arturbosch.detekt.Detekt> {
// bootRun {
// sourceResources(sourceSets.main.get())
// }
//}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
exclude("**/generated/**") exclude("**/generated/**")
doFirst {
}
setSource("src/main/kotlin") setSource("src/main/kotlin")
exclude("build/") exclude("build/")
} configureEach {
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**") exclude("**/org/koin/ksp/generated/**", "**/generated/**")
} }
}
tasks.withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>().configureEach { withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>() {
configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**") exclude("**/org/koin/ksp/generated/**", "**/generated/**")
} }
}
withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.naming/javax.naming=ALL-UNNAMED",
"--add-opens",
"java.base/java.util.concurrent.locks=ALL-UNNAMED"
).toMutableList()
}
}
}
project.gradle.taskGraph.whenReady { project.gradle.taskGraph.whenReady {
println(this.allTasks)
this.allTasks.map { println(it.name) }
if (this.hasTask(":koverGenerateArtifact")) { if (this.hasTask(":koverGenerateArtifact")) {
println("has task")
val task = this.allTasks.find { it.name == "test" } val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true verificationTask.ignoreFailures = true
@ -219,7 +211,10 @@ kover {
reports { reports {
verify { verify {
rule { rule {
minBound(50) bound{
minValue = 50
coverageUnits = CoverageUnit.INSTRUCTION
}
} }
} }
filters { filters {
@ -248,10 +243,7 @@ licenseReport {
importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml"))) importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml")))
renderers = arrayOf<ReportRenderer>( renderers = arrayOf<ReportRenderer>(
InventoryHtmlReportRenderer(), InventoryHtmlReportRenderer(), CsvReportRenderer(), JsonReportRenderer(), XmlReportRenderer()
CsvReportRenderer(),
JsonReportRenderer(),
XmlReportRenderer()
) )
filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true)) filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true))
allowedLicensesFile = File("$projectDir/allowed-licenses.json") allowedLicensesFile = File("$projectDir/allowed-licenses.json")