Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not add dependent source sets for @sample source roots #3610

Open
IgnatBeresnev opened this issue May 15, 2024 · 0 comments
Open

Do not add dependent source sets for @sample source roots #3610

IgnatBeresnev opened this issue May 15, 2024 · 0 comments
Labels
topic: K2 Issues / PRs that are related to the K2 migration. See #2888

Comments

@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented May 15, 2024

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.

@IgnatBeresnev IgnatBeresnev added the topic: K2 Issues / PRs that are related to the K2 migration. See #2888 label May 15, 2024
@vmishenev vmishenev changed the title Add a warning for intersecting @sample source roots Do not add dependent source sets for @sample source roots May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: K2 Issues / PRs that are related to the K2 migration. See #2888
Projects
None yet
Development

No branches or pull requests

1 participant