aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2019-11-14 15:18:56 +0100
committerBłażej Kardyś <bkardys@virtuslab.com>2019-11-25 16:24:16 +0100
commitdac6ba2a589aa1e8a9f4a9c7af32026be77776b3 (patch)
treef7be54609c482f0a0e5b021db38410c0dee8a82f /runners/gradle-plugin
parentd3bd543f569656e66112e584ad86af95ae7ea000 (diff)
downloaddokka-dac6ba2a589aa1e8a9f4a9c7af32026be77776b3.tar.gz
dokka-dac6ba2a589aa1e8a9f4a9c7af32026be77776b3.tar.bz2
dokka-dac6ba2a589aa1e8a9f4a9c7af32026be77776b3.zip
First plugin draft
Diffstat (limited to 'runners/gradle-plugin')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt19
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt1
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt11
3 files changed, 22 insertions, 9 deletions
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 35ef118a..b668158d 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
@@ -63,6 +63,9 @@ open class DokkaTask : DefaultTask() {
@Input
var cacheRoot: String? = null
+ @Classpath
+ lateinit var pluginsConfiguration: Configuration
+
var multiplatform: NamedDomainObjectContainer<GradlePassConfigurationImpl>
@Suppress("UNCHECKED_CAST")
@Nested get() = (DslObject(this).extensions.getByName(MULTIPLATFORM_EXTENSION_NAME) as NamedDomainObjectContainer<GradlePassConfigurationImpl>)
@@ -155,13 +158,15 @@ open class DokkaTask : DefaultTask() {
val passConfigurationList = collectConfigurations()
.map { defaultPassConfiguration(it, globalConfig) }
- val configuration = GradleDokkaConfigurationImpl()
- configuration.outputDir = outputDirectory
- configuration.format = outputFormat
- configuration.generateIndexPages = true
- configuration.cacheRoot = cacheRoot
- configuration.impliedPlatforms = impliedPlatforms
- configuration.passesConfigurations = passConfigurationList
+ val configuration = GradleDokkaConfigurationImpl().apply {
+ outputDir = outputDirectory
+ format = outputFormat
+ generateIndexPages = true
+ cacheRoot = cacheRoot
+ impliedPlatforms = impliedPlatforms
+ passesConfigurations = passConfigurationList
+ pluginsClasspath = pluginsConfiguration.resolve().toList()
+ }
bootstrapProxy.configure(
BiConsumer { level, message ->
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 767bf4f4..52caba41 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
@@ -124,6 +124,7 @@ class GradleDokkaConfigurationImpl: DokkaConfiguration {
override var cacheRoot: String? = null
override var impliedPlatforms: List<String> = emptyList()
override var passesConfigurations: List<GradlePassConfigurationImpl> = emptyList()
+ override var pluginsClasspath: List<File> = emptyList()
}
class GradlePackageOptionsImpl: PackageOptions, Serializable {
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 6f8d55e4..d75d3b21 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
@@ -17,7 +17,8 @@ open class DokkaPlugin : Plugin<Project> {
override fun apply(project: Project) {
loadDokkaVersion()
val dokkaRuntimeConfiguration = addConfiguration(project)
- addTasks(project, dokkaRuntimeConfiguration, DokkaTask::class.java)
+ val pluginsConfiguration = project.configurations.create("dokkaPlugins")
+ addTasks(project, dokkaRuntimeConfiguration, pluginsConfiguration, DokkaTask::class.java)
}
private fun loadDokkaVersion() = DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties"))
@@ -27,7 +28,12 @@ open class DokkaPlugin : Plugin<Project> {
defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-fatjar:${DokkaVersion.version}")) }
}
- private fun addTasks(project: Project, runtimeConfiguration: Configuration, taskClass: Class<out DokkaTask>) {
+ private fun addTasks(
+ project: Project,
+ runtimeConfiguration: Configuration,
+ pluginsConfiguration: Configuration,
+ taskClass: Class<out DokkaTask>
+ ) {
if(GradleVersion.current() >= GradleVersion.version("4.10")) {
project.tasks.register(taskName, taskClass)
} else {
@@ -37,6 +43,7 @@ open class DokkaPlugin : Plugin<Project> {
task.multiplatform = project.container(GradlePassConfigurationImpl::class.java)
task.configuration = GradlePassConfigurationImpl()
task.dokkaRuntime = runtimeConfiguration
+ task.pluginsConfiguration = pluginsConfiguration
task.outputDirectory = File(project.buildDir, taskName).absolutePath
}
}