diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-07-05 10:04:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-05 10:04:55 +0200 |
commit | 9559158bfeeb274e9ccf1b4563f1b23b42afc493 (patch) | |
tree | 3ece0887623cfe2b7148af23001867a1dd5e6597 /runners | |
parent | cbd9733d3dd2f52992e98e7cebd072091a572529 (diff) | |
download | dokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.tar.gz dokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.tar.bz2 dokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.zip |
Decompose Kotlin/Java analysis (#3034)
* Extract analysis into separate modules
Diffstat (limited to 'runners')
6 files changed, 13 insertions, 8 deletions
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 184e61bb..2975749f 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,7 +10,9 @@ 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") + // TODO [beresnev] analysis switcher + val analysisKotlinDescriptors get() = fromModuleName("analysis-kotlin-descriptors") + 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/GradleDokkaSourceSetBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt index e27fee30..46712c81 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt @@ -393,7 +393,7 @@ open class GradleDokkaSourceSetBuilder( * * @see [GradleSourceLinkBuilder] for details. */ - @Suppress("DEPRECATION") // TODO [beresnev] ConfigureUtil will be removed in Gradle 8 + @Suppress("DEPRECATION") fun sourceLink(c: Closure<in GradleSourceLinkBuilder>) { val configured = org.gradle.util.ConfigureUtil.configure(c, GradleSourceLinkBuilder(project)) sourceLinks.add(configured) @@ -415,7 +415,7 @@ open class GradleDokkaSourceSetBuilder( * * @see [GradlePackageOptionsBuilder] for details. */ - @Suppress("DEPRECATION") // TODO [beresnev] ConfigureUtil will be removed in Gradle 8 + @Suppress("DEPRECATION") fun perPackageOption(c: Closure<in GradlePackageOptionsBuilder>) { val configured = org.gradle.util.ConfigureUtil.configure(c, GradlePackageOptionsBuilder(project)) perPackageOptions.add(configured) @@ -437,7 +437,7 @@ open class GradleDokkaSourceSetBuilder( * * @see [GradleExternalDocumentationLinkBuilder] for details. */ - @Suppress("DEPRECATION") // TODO [beresnev] ConfigureUtil will be removed in Gradle 8 + @Suppress("DEPRECATION") fun externalDocumentationLink(c: Closure<in GradleExternalDocumentationLinkBuilder>) { val link = org.gradle.util.ConfigureUtil.configure(c, GradleExternalDocumentationLinkBuilder(project)) externalDocumentationLinks.add(link) 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 86dd3716..a3f8af2d 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 @@ -25,7 +25,7 @@ internal fun Project.maybeCreateDokkaPluginConfiguration(dokkaTaskName: String, extendsFrom(maybeCreateDokkaDefaultPluginConfiguration()) attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME)) isCanBeConsumed = false - dependencies.add(project.dokkaArtifacts.dokkaAnalysis) // compileOnly in base plugin + dependencies.add(project.dokkaArtifacts.analysisKotlinDescriptors) dependencies.add(project.dokkaArtifacts.dokkaBase) dependencies.addAll(additionalDependencies) } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt index c1e0c85b..9594887c 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType import kotlin.test.Test import kotlin.test.assertEquals +import org.jetbrains.dokka.gradle.utils.withDependencies_ class ConfigureWithKotlinSourceSetGistTest { @Test @@ -96,7 +97,7 @@ class ConfigureWithKotlinSourceSetGistTest { /* Make sure to remove dependencies that cannot be resolved during test */ project.configurations.configureEach { - withDependencies { + withDependencies_ { removeIf { dependency -> dependency !is FileCollectionDependency } } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt index c40b5811..713109bf 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.gradle +import org.jetbrains.dokka.gradle.utils.withDependencies_ import org.gradle.api.artifacts.FileCollectionDependency import org.gradle.kotlin.dsl.get import org.gradle.testfixtures.ProjectBuilder @@ -117,7 +118,7 @@ class KotlinSourceSetGistTest { /* Only work with file dependencies */ project.configurations.forEach { configuration -> - configuration.withDependencies { + configuration.withDependencies_ { removeIf { dependency -> dependency !is FileCollectionDependency } diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 64293332..8d790729 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -426,7 +426,8 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc offlineMode = offlineMode, cacheRoot = cacheRoot?.let(::File), sourceSets = listOf(sourceSet), - pluginsClasspath = getArtifactByMaven("org.jetbrains.dokka", "dokka-analysis", dokkaVersion) + // compileOnly in base plugin + // TODO [beresnev] analysis switcher + pluginsClasspath = getArtifactByMaven("org.jetbrains.dokka", "analysis-kotlin-descriptors", dokkaVersion) + getArtifactByMaven("org.jetbrains.dokka", "dokka-base", dokkaVersion) + dokkaPlugins.map { getArtifactByMaven(it.groupId, it.artifactId, it.version ?: dokkaVersion) } .flatten(), |