diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2021-07-06 18:27:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 18:27:09 +0200 |
commit | 468b49f0ab833a05c3e520b43a90087407e1d095 (patch) | |
tree | c869d04cc85f83a91ce194113c91740af4038242 | |
parent | acdda6c864a54c9224bc05dc54b7049aac3a92bd (diff) | |
download | dokka-468b49f0ab833a05c3e520b43a90087407e1d095.tar.gz dokka-468b49f0ab833a05c3e520b43a90087407e1d095.tar.bz2 dokka-468b49f0ab833a05c3e520b43a90087407e1d095.zip |
Fix Gradle plugin application (#2000)
Default dependency to dokka-base in dokkaPluginConfiguration was changed to a regular dependency. Applying client-side plugins overrode the default dokka-base dependency thus changing the version to a (possibly) lower one. This could lead to unpredictable Dokka crashes due to the inconsistency between the Gradle runner and dokka-base versions. Dependencies can still be manually removed from the configuration in specific projects, if needed (not likely)
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt | 8 | ||||
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt | 3 |
2 files changed, 5 insertions, 6 deletions
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 20f54cc5..583becd0 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 @@ -2,6 +2,7 @@ package org.jetbrains.dokka.gradle import org.gradle.api.Project import org.gradle.api.artifacts.Configuration +import org.gradle.api.artifacts.Dependency import org.gradle.api.attributes.Usage internal fun Project.maybeCreateDokkaDefaultPluginConfiguration(): Configuration { @@ -18,14 +19,13 @@ internal fun Project.maybeCreateDokkaDefaultRuntimeConfiguration(): Configuratio } } -internal fun Project.maybeCreateDokkaPluginConfiguration(dokkaTaskName: String): Configuration { +internal fun Project.maybeCreateDokkaPluginConfiguration(dokkaTaskName: String, additionalDependencies: Collection<Dependency> = emptySet()): Configuration { return project.configurations.maybeCreate("${dokkaTaskName}Plugin") { extendsFrom(maybeCreateDokkaDefaultPluginConfiguration()) attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "java-runtime")) isCanBeConsumed = false - defaultDependencies { dependencies -> - dependencies.add(project.dokkaArtifacts.dokkaBase) - } + dependencies.add(project.dokkaArtifacts.dokkaBase) + dependencies.addAll(additionalDependencies) } } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt index 483090da..41b29cdc 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt @@ -61,14 +61,13 @@ open class DokkaPlugin : Plugin<Project> { if (project.subprojects.isNotEmpty()) { if (multiModuleTaskSupported) { val multiModuleName = "${name}MultiModule" - project.maybeCreateDokkaPluginConfiguration(multiModuleName) + project.maybeCreateDokkaPluginConfiguration(multiModuleName, setOf(allModulesPageAndTemplateProcessing)) project.maybeCreateDokkaRuntimeConfiguration(multiModuleName) project.tasks.register<DokkaMultiModuleTask>(multiModuleName) { addSubprojectChildTasks("${name}Partial") configuration() description = "Runs all subprojects '$name' tasks and generates module navigation page" - plugins.dependencies.add(allModulesPageAndTemplateProcessing) } project.tasks.register<DefaultTask>("${name}Multimodule") { |