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

Make dokka-analysis dependency compileOnly in base plugin #2521

Merged
merged 3 commits into from Jun 9, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions integration-tests/cli/build.gradle.kts
Expand Up @@ -23,6 +23,7 @@ val basePluginShadow: Configuration by configurations.creating {

dependencies {
basePluginShadow(project(":plugins:base"))
basePluginShadow(project(":kotlin-analysis")) // compileOnly in base plugin
}
val basePluginShadowJar by tasks.register("basePluginShadowJar", ShadowJar::class) {
configurations = listOf(basePluginShadow)
Expand Down
4 changes: 1 addition & 3 deletions integration-tests/gradle/projects/it-basic/build.gradle.kts
Expand Up @@ -12,9 +12,7 @@ plugins {

buildscript {
dependencies {
classpath("org.jetbrains.dokka:dokka-base:${System.getenv("DOKKA_VERSION")}") {
exclude(group = "org.jetbrains.dokka", module = "dokka-analysis") // Gradle has embeddable Kotlin compiler
}
classpath("org.jetbrains.dokka:dokka-base:${System.getenv("DOKKA_VERSION")}")
}
}

Expand Down
1 change: 1 addition & 0 deletions plugins/all-modules-page/build.gradle.kts
Expand Up @@ -5,6 +5,7 @@ registerDokkaArtifactPublication("dokkaAllModulesPage") {
}

dependencies {
compileOnly(project(":kotlin-analysis"))
implementation(project(":plugins:base"))
implementation(project(":plugins:templating"))
testImplementation(project(":plugins:base"))
Expand Down
4 changes: 3 additions & 1 deletion plugins/base/build.gradle.kts
Expand Up @@ -5,7 +5,7 @@ dependencies {
val coroutines_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")

api(project(":kotlin-analysis"))
compileOnly(project(":kotlin-analysis"))
val jsoup_version: String by project
implementation("org.jsoup:jsoup:$jsoup_version")

Expand All @@ -20,6 +20,8 @@ dependencies {

val kotlinx_html_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version")

testImplementation(project(":kotlin-analysis"))
}

val projectDistDir = project(":plugins:base:frontend").file("dist")
Expand Down
Expand Up @@ -9,6 +9,7 @@ import utils.A
import utils.Span
import utils.TestOutputWriterPlugin
import utils.match
import java.lang.IllegalStateException

class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
private val configuration = dokkaConfiguration {
Expand All @@ -24,6 +25,19 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
}
}

private val jvmConfiguration = dokkaConfiguration {
sourceSets {
sourceSet {
sourceRoots = listOf("src/")
classpath = listOf(jvmStdlibPath ?: throw IllegalStateException("JVM stdlib is not found"))
externalDocumentationLinks = listOf(
stdlibExternalDocumentationLink,
DokkaConfiguration.ExternalDocumentationLink.Companion.jdk(8)
)
}
}
}

fun source(signature: String) =
"""
|/src/main/kotlin/test/Test.kt
Expand Down Expand Up @@ -282,7 +296,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {

testInline(
source,
configuration,
jvmConfiguration,
pluginOverrides = listOf(writerPlugin)
) {
renderingStage = { _, _ ->
Expand Down
2 changes: 1 addition & 1 deletion plugins/base/src/test/kotlin/signatures/SignatureTest.kt
Expand Up @@ -15,7 +15,7 @@ class SignatureTest : BaseAbstractTest() {
sourceSets {
sourceSet {
sourceRoots = listOf("src/")
classpath = listOf(commonStdlibPath!!)
classpath = listOf(commonStdlibPath ?: throw IllegalStateException("Common stdlib is not found"), jvmStdlibPath ?: throw IllegalStateException("JVM stdlib is not found"))
externalDocumentationLinks = listOf(stdlibExternalDocumentationLink)
}
}
Expand Down
1 change: 1 addition & 0 deletions plugins/javadoc/build.gradle.kts
@@ -1,6 +1,7 @@
import org.jetbrains.registerDokkaArtifactPublication

dependencies {
compileOnly(project(":kotlin-analysis"))
implementation("com.soywiz.korlibs.korte:korte-jvm:2.7.0")
implementation(project(":plugins:base"))
implementation(project(":plugins:kotlin-as-java"))
Expand Down
2 changes: 2 additions & 0 deletions plugins/kotlin-as-java/build.gradle.kts
@@ -1,12 +1,14 @@
import org.jetbrains.registerDokkaArtifactPublication

dependencies {
compileOnly(project(":kotlin-analysis"))
implementation(project(":plugins:base"))
testImplementation(project(":plugins:base"))
testImplementation(project(":plugins:base:base-test-utils"))
testImplementation(project(":core:content-matcher-test-utils"))
val jsoup_version: String by project
testImplementation("org.jsoup:jsoup:$jsoup_version")
testImplementation(project(":kotlin-analysis"))
}

registerDokkaArtifactPublication("kotlinAsJavaPlugin") {
Expand Down
Expand Up @@ -10,6 +10,7 @@ internal class DokkaArtifacts(private val project: Project) {
private fun fromModuleName(name: String): Dependency =
project.dependencies.create("org.jetbrains.dokka:$name:${DokkaVersion.version}")

val dokkaAnalysis get() = fromModuleName("dokka-analysis")
val allModulesPage get() = fromModuleName("all-modules-page-plugin")
val dokkaCore get() = fromModuleName("dokka-core")
val dokkaBase get() = fromModuleName("dokka-base")
Expand Down
Expand Up @@ -24,6 +24,7 @@ internal fun Project.maybeCreateDokkaPluginConfiguration(dokkaTaskName: String,
extendsFrom(maybeCreateDokkaDefaultPluginConfiguration())
attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "java-runtime"))
isCanBeConsumed = false
dependencies.add(project.dokkaArtifacts.dokkaAnalysis) // compileOnly in base plugin
dependencies.add(project.dokkaArtifacts.dokkaBase)
dependencies.addAll(additionalDependencies)
}
Expand Down
3 changes: 2 additions & 1 deletion runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
Expand Up @@ -257,7 +257,8 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
offlineMode = offlineMode,
cacheRoot = cacheRoot?.let(::File),
sourceSets = listOf(sourceSet),
pluginsClasspath = getArtifactByMaven("org.jetbrains.dokka", "dokka-base", dokkaVersion) +
pluginsClasspath = getArtifactByMaven("org.jetbrains.dokka", "dokka-analysis", dokkaVersion) + // compileOnly in base plugin
getArtifactByMaven("org.jetbrains.dokka", "dokka-base", dokkaVersion) +
dokkaPlugins.map { getArtifactByMaven(it.groupId, it.artifactId, it.version ?: dokkaVersion) }
.flatten(),
pluginsConfiguration = pluginsConfiguration.toMutableList(),
Expand Down