Skip to content

Commit

Permalink
Do not run dokka for test tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
kamildoleglo committed Jun 22, 2021
1 parent 67d6658 commit 26457f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 3 additions & 4 deletions build.gradle.kts
Expand Up @@ -55,15 +55,14 @@ subprojects {
val dokkaOutputDir = "$buildDir/dokka"

dokkaHtml {
onlyIf { !isLocalPublication }
outputDirectory.set(file(dokkaOutputDir))
}

register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
if (!isLocalPublication) {
dependsOn(dokkaHtml)
from(dokkaOutputDir)
}
dependsOn(dokkaHtml)
from(dokkaOutputDir)
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion buildSrc/src/main/kotlin/org/jetbrains/taskUtils.kt
Expand Up @@ -14,4 +14,9 @@ fun Task.dependsOnMavenLocalPublication() {
}

val Project.isLocalPublication: Boolean
get() = gradle.startParameter.taskNames.contains("publishToMavenLocal")
get() = gradle.startParameter.taskNames.any {
it.equals("publishToMavenLocal", ignoreCase = true) ||
it.equals("integrationTest", ignoreCase = true) ||
it.equals("check", ignoreCase = true) ||
it.equals("test", ignoreCase = true)
}

0 comments on commit 26457f9

Please sign in to comment.