diff options
Diffstat (limited to 'runners')
6 files changed, 53 insertions, 9 deletions
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt index 3ecc7b94..038bfca9 100644 --- a/runners/ant/src/main/kotlin/ant/dokka.kt +++ b/runners/ant/src/main/kotlin/ant/dokka.kt @@ -153,6 +153,7 @@ class DokkaAntTask: Task(), DokkaConfiguration { override var cacheRoot: String? = null override val passesConfigurations: MutableList<AntPassConfig> = mutableListOf() + override var pluginsClasspath: List<File> = mutableListOf() fun createPassConfig() = AntPassConfig(this).apply { passesConfigurations.add(this) } fun createImpliedPlatform(): TextProperty = TextProperty().apply { buildImpliedPlatforms.add(this) } diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt index 52815e75..32ce762d 100644 --- a/runners/cli/src/main/kotlin/cli/main.kt +++ b/runners/cli/src/main/kotlin/cli/main.kt @@ -35,6 +35,8 @@ open class GlobalArguments(parser: DokkaArgumentsParser) : DokkaConfiguration { ) { Arguments(parser) } + + override var pluginsClasspath: List<File> = emptyList() } class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfiguration { diff --git a/runners/fatjar/build.gradle b/runners/fatjar/build.gradle index 4ce0416c..1da23841 100644 --- a/runners/fatjar/build.gradle +++ b/runners/fatjar/build.gradle @@ -1,5 +1,6 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer import org.jetbrains.PluginXmlTransformer +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' @@ -18,7 +19,28 @@ jar { shadowJar { baseName = 'dokka-fatjar' classifier = '' + configurations { + exclude compileOnly + } + + transform(ServiceFileTransformer) + transform(PluginXmlTransformer) + + exclude 'colorScheme/**' + exclude 'fileTemplates/**' + exclude 'inspectionDescriptions/**' + exclude 'intentionDescriptions/**' + + exclude 'src/**' + + relocate('kotlin.reflect.full', 'kotlin.reflect') +} + +task apiShadow(type: ShadowJar) { + baseName = 'dokka-fatapi' + classifier = '' + configurations = [project.configurations.compile] configurations { exclude compileOnly } @@ -26,6 +48,7 @@ shadowJar { transform(ServiceFileTransformer) transform(PluginXmlTransformer) + exclude 'kotlin/**' exclude 'colorScheme/**' exclude 'fileTemplates/**' exclude 'inspectionDescriptions/**' @@ -44,6 +67,11 @@ publishing { artifactId = 'dokka-fatjar' project.shadow.component(publication) } + + dokkaFatApi(MavenPublication) {publication -> + artifactId = 'dokka-fatapi' + publication.artifact(project.tasks.apiShadow) + } } } 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 } } |