diff options
Diffstat (limited to 'runners/gradle-plugin/src')
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 } } |