From 6c1403cd8ffab5e13f12a2744846a70b31710b09 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 7 Jul 2020 14:47:50 +0200 Subject: Annotate all properties on DokkaTask and DokkaMultimoduleTask to support the `validatePlugins` task --- .../org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt | 10 ++++++++-- .../main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt | 14 ++++++++++---- .../jetbrains/dokka/gradle/configurationImplementations.kt | 5 +++-- 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka') diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt index 2ef85de2..803c91c0 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt @@ -5,6 +5,7 @@ import org.gradle.api.DefaultTask import org.gradle.api.artifacts.Configuration import org.gradle.api.tasks.Classpath import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction import org.jetbrains.dokka.DokkaBootstrap import org.jetbrains.dokka.plugability.Configurable @@ -22,11 +23,15 @@ open class DokkaMultimoduleTask : DefaultTask(), Configurable { @Input var outputDirectory: String = "" - @Classpath + @get:Classpath lateinit var pluginsConfig: Configuration + internal set - var dokkaRuntime: Configuration? = null + @get:Classpath + lateinit var dokkaRuntime: Configuration + internal set + @Input override val pluginsConfiguration: Map = mutableMapOf() @TaskAction @@ -64,6 +69,7 @@ open class DokkaMultimoduleTask : DefaultTask(), Configurable { } } + @Internal internal fun getConfiguration(): GradleDokkaConfigurationImpl = GradleDokkaConfigurationImpl().apply { outputDir = project.file(outputDirectory).absolutePath diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt index aac7e2a0..d4ade2d9 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt @@ -50,7 +50,9 @@ open class DokkaTask : DefaultTask(), Configurable { @Input var outputDirectory: String = "" - var dokkaRuntime: Configuration? = null + @get:Classpath + lateinit var dokkaRuntime: Configuration + internal set @Input var subProjects: List = emptyList() @@ -62,9 +64,11 @@ open class DokkaTask : DefaultTask(), Configurable { @Input var cacheRoot: String? = null - @Classpath + @get:Classpath lateinit var pluginsClasspathConfiguration: Configuration + internal set + @get:Internal internal var config: GradleDokkaConfigurationImpl? = null var dokkaSourceSets: NamedDomainObjectContainer @@ -94,7 +98,7 @@ open class DokkaTask : DefaultTask(), Configurable { private fun loadCore() { if (ClassloaderContainer.coreClassLoader == null) { - val jars = dokkaRuntime!!.resolve() + val jars = dokkaRuntime.resolve() ClassloaderContainer.coreClassLoader = URLClassLoader( jars.map { it.toURI().toURL() }.toTypedArray(), ClassLoader.getSystemClassLoader().parent @@ -176,6 +180,7 @@ open class DokkaTask : DefaultTask(), Configurable { } } + @Internal internal fun getConfigurationOrNull(): GradleDokkaConfigurationImpl? { val globalConfig = dokkaSourceSets.toList().find { it.name.toLowerCase() == GLOBAL_CONFIGURATION_NAME } val defaultModulesConfiguration = configuredDokkaSourceSets @@ -200,6 +205,7 @@ open class DokkaTask : DefaultTask(), Configurable { } } + @Internal internal fun getConfigurationOrThrow(): GradleDokkaConfigurationImpl { return getConfigurationOrNull() ?: throw DokkaException( """ @@ -218,7 +224,7 @@ open class DokkaTask : DefaultTask(), Configurable { ) } - + @get:Internal protected val configuredDokkaSourceSets: List get() = dokkaSourceSets .filterNot { it.name.toLowerCase() == GLOBAL_CONFIGURATION_NAME } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt index 7b2d05a6..49819f9a 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt @@ -34,8 +34,8 @@ class GradleSourceRootImpl : SourceRoot, Serializable { } open class GradleDokkaSourceSet constructor( - @Transient val name: String, - @Transient internal val project: Project + @Transient @get:Input val name: String, + @Transient @get:Internal internal val project: Project ) : DokkaSourceSet { @Input @@ -117,6 +117,7 @@ open class GradleDokkaSourceSet constructor( @Optional var platform: String? = null + @Internal @Transient var collectKotlinTasks: (() -> List?)? = null -- cgit