Skip to content

Commit

Permalink
detekt和publish配置
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Apr 9, 2024
1 parent e3e5cf1 commit 3dfc66c
Show file tree
Hide file tree
Showing 6 changed files with 856 additions and 11 deletions.
24 changes: 24 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/


import io.gitlab.arturbosch.detekt.Detekt
import love.forte.gradle.common.core.project.setup
import love.forte.gradle.common.core.repository.Repositories

Expand All @@ -24,6 +25,7 @@ plugins {
`simbot-telegram-changelog-generator`
`simbot-telegram-dokka-multi-module`
`simbot-telegram-nexus-publish`
alias(libs.plugins.detekt)
}

setup(P.ComponentTelegram)
Expand Down Expand Up @@ -62,3 +64,25 @@ idea {
}
}
}

detekt {
source.setFrom(
"simbot-component-telegram-api",
"simbot-component-telegram-core",
"simbot-component-telegram-stdlib",
"simbot-component-telegram-type",
)

config.setFrom(rootDir.resolve("config/detekt/detekt.yml"))
baseline = file("$projectDir/config/detekt/baseline.xml")
parallel = true
reportsDir = rootProject.layout.buildDirectory.dir("detekt/report").get().asFile
}

// https://detekt.dev/blog/2019/03/03/configure-detekt-on-root-project/
tasks.withType<Detekt>().configureEach {
exclude("**/resources/")
exclude("**/build/")
exclude("**/*Test/kotlin/")
exclude("**/*Test/java/")
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,46 @@ multiplatformConfigPublishing {
project = P.ComponentTelegram
isSnapshot = project.version.toString().contains("SNAPSHOT", true)

val jarJavadoc by tasks.registering(Jar::class) {
group = "documentation"
archiveClassifier.set("javadoc")
if (!(isSnapshot || isSnapshot() || isSimbotLocal())) {
archiveClassifier.set("javadoc")
from(tasks.findByName("dokkaHtml"))
publishing {
publications.withType<MavenPublication> {
val dokkaJar = p.tasks.register("${name}DokkaJar", Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka into a Javadoc jar"
archiveClassifier.set("javadoc")
from(tasks.named("dokkaHtml"))

// Each archive name should be distinct, to avoid implicit dependency issues.
// We use the same format as the sources Jar tasks.
// https://youtrack.jetbrains.com/issue/KT-46466
archiveBaseName.set("${archiveBaseName.get()}-${name}")
}
artifact(dokkaJar)
}
}

artifact(jarJavadoc)
// val jarJavadoc by tasks.registering(Jar::class) {
// group = "documentation"
// archiveClassifier.set("javadoc")
// if (!(isSnapshot || isSnapshot() || isSimbotLocal())) {
// archiveClassifier.set("javadoc")
// from(tasks.findByName("dokkaHtml"))
// }
// }


// val dokkaJar = p.tasks.register("${publication.name}DokkaJar", Jar::class) {
// group = JavaBasePlugin.DOCUMENTATION_GROUP
// description = "Assembles Kotlin docs with Dokka into a Javadoc jar"
// archiveClassifier.set("javadoc")
// from(tasks.named("dokkaHtml"))
//
// // Each archive name should be distinct, to avoid implicit dependency issues.
// // We use the same format as the sources Jar tasks.
// // https://youtrack.jetbrains.com/issue/KT-46466
// archiveBaseName.set("${archiveBaseName.get()}-${publication.name}")
// }

// artifact(dokkaJar)
releasesRepository = ReleaseRepository
snapshotRepository = SnapshotRepository
gpg = Gpg.ofSystemPropOrNull()
Expand Down
Loading

0 comments on commit 3dfc66c

Please sign in to comment.