Hideout/owl/build.gradle.kts

168 lines
4.4 KiB
Plaintext
Raw Permalink Normal View History

import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
plugins {
2024-07-29 07:26:41 +00:00
alias(libs.plugins.kotlin.jvm)
2024-08-10 03:18:52 +00:00
id("maven-publish")
alias(libs.plugins.kover)
alias(libs.plugins.detekt)
}
allprojects {
group = "dev.usbharu"
2024-08-10 08:01:26 +00:00
version = "0.0.2-SNAPSHOT"
repositories {
mavenCentral()
}
}
2024-08-10 03:18:52 +00:00
tasks {
create("publishMavenPublicationToMavenLocal") {
subprojects.forEach { dependsOn("${it.path}:publishMavenPublicationToMavenLocal") }
}
create("publishMavenPublicationToGiteaRepository") {
subprojects.forEach { dependsOn("${it.path}:publishMavenPublicationToGiteaRepository") }
}
}
subprojects {
apply {
plugin("org.jetbrains.kotlin.jvm")
2024-08-10 03:18:52 +00:00
plugin("maven-publish")
plugin(rootProject.libs.plugins.kover.get().pluginId)
plugin(rootProject.libs.plugins.detekt.get().pluginId)
}
kotlin {
jvmToolchain(21)
}
dependencies {
implementation("org.slf4j:slf4j-api:2.0.15")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.3")
detektPlugins(rootProject.libs.detekt.formatting)
}
detekt {
parallel = true
config.setFrom(files("$rootDir/../detekt.yml"))
buildUponDefaultConfig = true
basePath = "${projectDir}/src/main/kotlin"
autoCorrect = true
}
project.gradle.taskGraph.whenReady {
if (this.hasTask(":koverGenerateArtifact")) {
val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true
}
}
2024-09-17 13:02:29 +00:00
tasks {
withType<io.gitlab.arturbosch.detekt.Detekt> {
exclude("**/generated/**")
setSource("src/main/kotlin")
exclude("build/")
configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
}
withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>() {
configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
}
withType<Test> {
useJUnitPlatform()
}
}
2024-08-10 03:18:52 +00:00
publishing {
repositories {
maven {
name = "Gitea"
url = uri("https://git.usbharu.dev/api/packages/usbharu/maven")
credentials(HttpHeaderCredentials::class) {
2024-08-10 03:18:52 +00:00
name = "Authorization"
value = "token " + (project.findProperty("gpr.gitea") as String? ?: System.getenv("GITEA"))
}
2024-08-10 03:18:52 +00:00
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}
publications {
register<MavenPublication>("maven") {
groupId = "dev.usbharu"
artifactId = project.name
version = project.version.toString()
from(components["kotlin"])
}
}
}
}
dependencies {
kover(project(":owl-broker"))
kover(project(":owl-broker:owl-broker-mongodb"))
kover(project(":owl-common"))
kover(project(":owl-common:owl-common-serialize-jackson"))
kover(project(":owl-consumer"))
kover(project(":owl-producer"))
kover(project(":owl-producer:owl-producer-api"))
kover(project(":owl-producer:owl-producer-default"))
kover(project(":owl-producer:owl-producer-embedded"))
}
detekt {
parallel = true
config.setFrom(files("../detekt.yml"))
buildUponDefaultConfig = true
basePath = "${projectDir}/src/main/kotlin"
autoCorrect = true
}
project.gradle.taskGraph.whenReady {
if (this.hasTask(":koverGenerateArtifact")) {
val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true
}
}
kover {
currentProject {
sources {
excludedSourceSets.addAll("grpc", "grpckt")
}
}
reports {
verify {
rule {
bound {
minValue = 50
coverageUnits = CoverageUnit.INSTRUCTION
}
}
}
total {
xml {
title = "Owl"
xmlFile = file("$buildDir/reports/kover/owl.xml")
}
filters {
excludes {
packages("dev.usbharu.owl.generated")
}
}
}
}
}