From 2e02e56818609c683f95ba4f17fa749eb9e1c705 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 1 Jul 2020 16:38:56 +0200 Subject: runner:gradle-plugin: Apply `java-gradle-plugin` --- runners/gradle-plugin/build.gradle.kts | 28 ++++++++++------------ .../main/kotlin/org/jetbrains/dokka/gradle/main.kt | 18 ++------------ 2 files changed, 14 insertions(+), 32 deletions(-) (limited to 'runners/gradle-plugin') diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts index d2e9eccd..e0241f67 100644 --- a/runners/gradle-plugin/build.gradle.kts +++ b/runners/gradle-plugin/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.configureBintrayPublication plugins { id("com.gradle.plugin-publish") + `java-gradle-plugin` } repositories { @@ -26,19 +27,6 @@ dependencies { } } -tasks { - processResources { - val dokka_version: String by project - eachFile { - if (name == "org.jetbrains.dokka.properties") { - filter { line -> - line.replace("", dokka_version) - } - } - } - } -} - val sourceJar by tasks.registering(Jar::class) { archiveClassifier.set("sources") from(sourceSets["main"].allSource) @@ -56,6 +44,15 @@ publishing { configureBintrayPublication("dokkaGradlePlugin") // TODO check if this publishes correctly +gradlePlugin { + plugins { + create("dokkaGradlePlugin") { + id = "org.jetbrains.dokka" + implementationClass = "org.jetbrains.dokka.gradle.DokkaPlugin" + } + } +} + pluginBundle { // TODO check if this publishes correctly website = "https://www.kotlinlang.org/" @@ -64,8 +61,7 @@ pluginBundle { tags = listOf("dokka", "kotlin", "kdoc", "android") plugins { - create("dokkaGradlePlugin") { - id = "org.jetbrains.dokka" + getByName("dokkaGradlePlugin") { displayName = "Dokka plugin" } } @@ -74,4 +70,4 @@ pluginBundle { groupId = "org.jetbrains.dokka" artifactId = "dokka-gradle-plugin" } -} \ No newline at end of file +} 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 2b076fd0..92d63a40 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 @@ -5,9 +5,8 @@ import org.gradle.api.Project import org.gradle.api.artifacts.Configuration import org.gradle.api.attributes.Usage import org.gradle.util.GradleVersion +import org.jetbrains.dokka.DokkaVersion import java.io.File -import java.io.InputStream -import java.util.* internal const val SOURCE_SETS_EXTENSION_NAME = "dokkaSourceSets" internal const val DOKKA_TASK_NAME = "dokka" @@ -16,7 +15,6 @@ internal const val DOKKA_MULTIMODULE_TASK_NAME = "dokkaMultimodule" open class DokkaPlugin : Plugin { override fun apply(project: Project) { - loadDokkaVersion() val dokkaRuntimeConfiguration = addConfiguration(project) val pluginsConfiguration = project.configurations.create("dokkaPlugins").apply { dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-base:${DokkaVersion.version}")) @@ -35,8 +33,6 @@ open class DokkaPlugin : Plugin { ) } - private fun loadDokkaVersion() = - DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties")) private fun addConfiguration(project: Project) = project.configurations.create("dokkaRuntime").apply { @@ -99,17 +95,7 @@ open class DokkaPlugin : Plugin { } } -object DokkaVersion { - var version: String? = null - - fun loadFrom(stream: InputStream) { - version = Properties().apply { - load(stream) - }.getProperty("dokka-version") - } -} - internal object ClassloaderContainer { @JvmField var coreClassLoader: ClassLoader? = null -} \ No newline at end of file +} -- cgit