Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion buildSrc/src/main/kotlin/DependencyResolution.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, TeamDev. All rights reserved.
* Copyright 2026, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,7 @@ import io.spine.dependency.build.Dokka
import io.spine.dependency.build.ErrorProne
import io.spine.dependency.build.FindBugs
import io.spine.dependency.build.JSpecify
import io.spine.dependency.isDokka
import io.spine.dependency.lib.Asm
import io.spine.dependency.lib.AutoCommon
import io.spine.dependency.lib.AutoService
Expand Down Expand Up @@ -73,6 +74,9 @@ fun doForceVersions(configurations: ConfigurationContainer) {
*/
fun NamedDomainObjectContainer<Configuration>.forceVersions() {
all {
if (isDokka) {
return@all
}
resolutionStrategy {
failOnVersionConflict()
cacheChangingModulesFor(0, "seconds")
Expand Down
11 changes: 10 additions & 1 deletion buildSrc/src/main/kotlin/dokka-setup.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, TeamDev. All rights reserved.
* Copyright 2026, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,6 +41,15 @@ tasks.withType<DokkaBaseTask>().configureEach {
}
}

// The Dokka Javadoc format does not support Kotlin Multiplatform source sets, so its
// publication task fails for KMP modules ("No source set found for <module>/jvmMain").
// KMP modules publish HTML documentation, so skip the Javadoc publication for them.
plugins.withId("org.jetbrains.kotlin.multiplatform") {
tasks.matching { it.name == "dokkaGeneratePublicationJavadoc" }.configureEach {
enabled = false
}
}

afterEvaluate {
dokka {
configureForKotlin(
Expand Down
11 changes: 11 additions & 0 deletions buildSrc/src/main/kotlin/io/spine/dependency/Dependency.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ abstract class DependencyWithBom : Dependency() {
fun Configuration.diagSuffix(project: Project): String =
"the configuration `$name` in the project: `${project.path}`."

/**
* Tells if this configuration belongs to Dokka's own generator/plugin classpath.
*
* Dokka resolves these `dokka*` configurations using dependency versions pinned by
* Dokka itself (for example, Jackson or Kotlin), which legitimately differ from the
* project's. Forcing the project's versions onto them breaks `dokkaGenerate`, so such
* configurations must be excluded from the project's version forcing.
*/
val Configuration.isDokka: Boolean
get() = name.startsWith("dokka")

private fun ResolutionStrategy.forceWithLogging(
project: Project,
configuration: Configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ package io.spine.dependency.boms
import io.gitlab.arturbosch.detekt.getSupportedKotlinVersion
import io.spine.dependency.DependencyWithBom
import io.spine.dependency.diagSuffix
import io.spine.dependency.isDokka
import io.spine.dependency.kotlinx.Coroutines
import io.spine.dependency.lib.Kotlin
import io.spine.dependency.test.JUnit
Expand Down Expand Up @@ -88,7 +89,7 @@ class BomsPlugin : Plugin<Project> {
applyBoms(project, Boms.core + Boms.testing)
}

matching { !supportsBom(it.name) }.all {
matching { !supportsBom(it.name) && !it.isDokka }.all {
resolutionStrategy.eachDependency {
if (requested.group == Kotlin.group) {
val kotlinVersion = Kotlin.runtimeVersion
Expand Down Expand Up @@ -170,7 +171,7 @@ private fun supportsBom(name: String) =
private fun Project.forceArtifacts() =
configurations.all {
resolutionStrategy {
if (!isDetekt) {
if (!isDetekt && !isDokka) {
val rs = this@resolutionStrategy
val project = this@forceArtifacts
val cfg = this@all
Expand Down
4 changes: 4 additions & 0 deletions buildSrc/src/main/kotlin/jvm-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import io.spine.dependency.build.CheckerFramework
import io.spine.dependency.build.Dokka
import io.spine.dependency.build.ErrorProne
import io.spine.dependency.build.JSpecify
import io.spine.dependency.isDokka
import io.spine.dependency.lib.Guava
import io.spine.dependency.lib.Jackson
import io.spine.dependency.lib.Kotlin
Expand Down Expand Up @@ -132,6 +133,9 @@ fun Module.forceConfigurations() {
forceVersions()
excludeProtobufLite()
all {
if (isDokka) {
return@all
}
resolutionStrategy {
val cfg = this@all
val rs = this@resolutionStrategy
Expand Down
4 changes: 4 additions & 0 deletions buildSrc/src/main/kotlin/kmp-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

import io.spine.dependency.boms.BomsPlugin
import io.spine.dependency.isDokka
import io.spine.dependency.lib.Jackson
import io.spine.dependency.lib.Kotlin
import io.spine.dependency.local.Reflect
Expand Down Expand Up @@ -83,6 +84,9 @@ fun Project.forceConfigurations() {
with(configurations) {
forceVersions()
all {
if (isDokka) {
return@all
}
resolutionStrategy {
val cfg = this@all
val rs = this@resolutionStrategy
Expand Down
Loading