Do not add dependent source sets for @sample source roots
IgnatBeresnev opened this issue · comments
Context
K2's analysis API does not support having two different KtModule with the same file system directory or intersecting files, it throws an error in this case (see #3239)
Execution failed for task ':dokkaHtml'
Caused by: org.jetbrains.kotlin.utils.exceptions.KotlinIllegalStateExceptionWithAttachments: Modules are inconsistent
at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirFileBuilder$buildRawFirFileWithCaching$1.invoke(LLFirFileBuilder.kt:56)
at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirFileBuilder$buildRawFirFileWithCaching$1.invoke(LLFirFileBuilder.kt:25)
This applies not only to the source set's source roots, but to the samples
configuration as well, because the analysis for resolving samples is configured in a similar. Meaning, having the following configuration would lead to an error in K2 (see #3373)
tasks.dokkaHtml.configure {
dokkaSourceSets {
configureEach {
samples.from("src/commonMain/kotlin/samples.kt")
}
}
}
Execution failed for task ':dokkaHtml'
Caused by: org.jetbrains.kotlin.utils.exceptions.KotlinIllegalStateExceptionWithAttachments: Modules are inconsistent
at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirFileBuilder$buildRawFirFileWithCaching$1.invoke(LLFirFileBuilder.kt:56)
Proposal
It's unclear how popular the given sample configuration is, and whether it should be possible at all - it's more of a KDoc spec question (#1264, #3079).
Since Dokka K1 adds no dependent source sets for samples, the behavior of K1 should be restored for now.