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

Fix Gradle plugin application #2000

Merged
merged 1 commit into from
Jul 6, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down