diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-07-07 14:47:50 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-07-07 15:33:15 +0200 |
commit | 6c1403cd8ffab5e13f12a2744846a70b31710b09 (patch) | |
tree | 578a9c1f2fb85df0c3bb23ea9fb10a6b554411e5 /runners | |
parent | 7d7d88e1969fd8534a538fc3c3953ce1d6daa14b (diff) | |
download | dokka-6c1403cd8ffab5e13f12a2744846a70b31710b09.tar.gz dokka-6c1403cd8ffab5e13f12a2744846a70b31710b09.tar.bz2 dokka-6c1403cd8ffab5e13f12a2744846a70b31710b09.zip |
Annotate all properties on DokkaTask and DokkaMultimoduleTask to support the `validatePlugins` task
Diffstat (limited to 'runners')
4 files changed, 21 insertions, 11 deletions
diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts index 6b0e894c..77fbe4a7 100644 --- a/runners/gradle-plugin/build.gradle.kts +++ b/runners/gradle-plugin/build.gradle.kts @@ -34,9 +34,6 @@ val sourceJar by tasks.registering(Jar::class) { from(sourceSets["main"].allSource) } -// TODO: https://github.com/Kotlin/dokka/issues/1052 -tasks.getByName("validatePlugins").enabled = false - val gradlePluginImplementationClass = "org.jetbrains.dokka.gradle.DokkaPlugin" publishing { 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<String, String> = 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<String> = 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<GradleDokkaSourceSet> @@ -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<GradleDokkaSourceSet> 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<Any?>?)? = null |