diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2022-06-09 18:02:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 18:02:44 +0300 |
commit | 7e877abf5c2715ab5efa27a38b83d0bf9be1374b (patch) | |
tree | eb010be8299fad7f639097912de253e8d5058f83 | |
parent | 8c2a79f39377892be44d752d0958efb9b83f1fce (diff) | |
download | dokka-7e877abf5c2715ab5efa27a38b83d0bf9be1374b.tar.gz dokka-7e877abf5c2715ab5efa27a38b83d0bf9be1374b.tar.bz2 dokka-7e877abf5c2715ab5efa27a38b83d0bf9be1374b.zip |
Make `dokka-analysis` dependency compileOnly in base plugin (#2521)
11 files changed, 29 insertions, 7 deletions
diff --git a/integration-tests/cli/build.gradle.kts b/integration-tests/cli/build.gradle.kts index d9961f8f..33c2b827 100644 --- a/integration-tests/cli/build.gradle.kts +++ b/integration-tests/cli/build.gradle.kts @@ -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) diff --git a/integration-tests/gradle/projects/it-basic/build.gradle.kts b/integration-tests/gradle/projects/it-basic/build.gradle.kts index 3f7dd32b..b2a84e5f 100644 --- a/integration-tests/gradle/projects/it-basic/build.gradle.kts +++ b/integration-tests/gradle/projects/it-basic/build.gradle.kts @@ -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")}") } } diff --git a/plugins/all-modules-page/build.gradle.kts b/plugins/all-modules-page/build.gradle.kts index ff9fcbd8..f993d45c 100644 --- a/plugins/all-modules-page/build.gradle.kts +++ b/plugins/all-modules-page/build.gradle.kts @@ -5,6 +5,7 @@ registerDokkaArtifactPublication("dokkaAllModulesPage") { } dependencies { + compileOnly(project(":kotlin-analysis")) implementation(project(":plugins:base")) implementation(project(":plugins:templating")) testImplementation(project(":plugins:base")) diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts index e77d271e..91684ece 100644 --- a/plugins/base/build.gradle.kts +++ b/plugins/base/build.gradle.kts @@ -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") @@ -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") diff --git a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt index 1e0a5404..66d84967 100644 --- a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt @@ -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 { @@ -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 @@ -282,7 +296,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() { testInline( source, - configuration, + jvmConfiguration, pluginOverrides = listOf(writerPlugin) ) { renderingStage = { _, _ -> diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index 75c199fa..59665b8c 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -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) } } diff --git a/plugins/javadoc/build.gradle.kts b/plugins/javadoc/build.gradle.kts index 2b218aa2..471e4dda 100644 --- a/plugins/javadoc/build.gradle.kts +++ b/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")) diff --git a/plugins/kotlin-as-java/build.gradle.kts b/plugins/kotlin-as-java/build.gradle.kts index 5cfc3d22..fb20d659 100644 --- a/plugins/kotlin-as-java/build.gradle.kts +++ b/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") { diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt index 3349f996..184e61bb 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt @@ -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") diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt index 583becd0..7b924b75 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt @@ -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) } diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 64cf8ee2..581d4c9e 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -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(), |