aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-01 16:38:56 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-07-02 12:48:53 +0200
commit2e02e56818609c683f95ba4f17fa749eb9e1c705 (patch)
tree53c1ccadcb26f651dec20ed7874db202081fc825 /runners/gradle-plugin
parentbadd2d7e4bfad519f31b69ae9c1bea5659f3c59b (diff)
downloaddokka-2e02e56818609c683f95ba4f17fa749eb9e1c705.tar.gz
dokka-2e02e56818609c683f95ba4f17fa749eb9e1c705.tar.bz2
dokka-2e02e56818609c683f95ba4f17fa749eb9e1c705.zip
runner:gradle-plugin: Apply `java-gradle-plugin`
Diffstat (limited to 'runners/gradle-plugin')
-rw-r--r--runners/gradle-plugin/build.gradle.kts28
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt18
2 files changed, 14 insertions, 32 deletions
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("<version>", 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<Project> {
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<Project> {
)
}
- 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<Project> {
}
}
-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
+}