Skip to content

Commit 6a4e612

Browse files
committed
Add Dokka plugin and rework publishing
Signed-off-by: Dmitry Sulman <[email protected]>
1 parent 1b252ef commit 6a4e612

File tree

5 files changed

+42
-12
lines changed

5 files changed

+42
-12
lines changed

build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
plugins {
2+
kotlin("jvm")
3+
alias(libs.plugins.jreleaser)
4+
}
5+
6+
repositories {
7+
mavenCentral()
8+
gradlePluginPortal()
9+
}
10+
11+
val jreleaserFullRelease by tasks.existing {
12+
subprojects.forEach {
13+
val copyStagingDeployToRoot by it.tasks.existing
14+
dependsOn(copyStagingDeployToRoot)
15+
}
16+
}

buildSrc/build.gradle.kts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
plugins {
22
`kotlin-dsl`
3-
alias(libs.plugins.jreleaser)
43
}
54

65
repositories {
76
mavenCentral()
7+
gradlePluginPortal()
88
}
99

1010
kotlin {
1111
jvmToolchain(17)
1212
}
1313

1414
dependencies {
15+
implementation(libs.dokka.gradlePlugin)
16+
implementation(libs.dokka.javadocPlugin)
1517
implementation(libs.kotlin.gradlePlugin)
16-
}
17-
18-
val copyStagingDeploy by tasks.registering(Copy::class) {
19-
from("../logback-access-reactor-netty/build/staging-deploy")
20-
into("build/staging-deploy")
21-
}
22-
23-
tasks.jreleaserFullRelease {
24-
dependsOn(copyStagingDeploy)
2518
}

buildSrc/src/main/kotlin/conventions.gradle.kts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
33
plugins {
44
kotlin("jvm")
55
`maven-publish`
6+
id("org.jetbrains.dokka")
7+
id("org.jetbrains.dokka-javadoc")
68
}
79

810
group = "io.github.dmitrysulman"
@@ -26,18 +28,32 @@ kotlin {
2628

2729
java {
2830
targetCompatibility = JavaVersion.VERSION_1_8
29-
withJavadocJar()
3031
withSourcesJar()
3132
}
3233

3334
tasks.withType<Test>().configureEach {
3435
useJUnitPlatform()
3536
}
3637

38+
val copyStagingDeployToRoot by tasks.registering(Copy::class) {
39+
group = "publishing"
40+
dependsOn(tasks.publish)
41+
from("./build/staging-deploy")
42+
into("../build/staging-deploy")
43+
}
44+
45+
val dokkaJavadocJar by tasks.registering(Jar::class) {
46+
group = "dokka"
47+
dependsOn(tasks.dokkaGeneratePublicationJavadoc)
48+
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
49+
archiveClassifier.set("javadoc")
50+
}
51+
3752
publishing {
3853
publications {
3954
create<MavenPublication>("maven") {
4055
from(components["java"])
56+
artifact(dokkaJavadocJar)
4157
pom {
4258
afterEvaluate {
4359
pom.name = project.description

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ version=1.0.0-SNAPSHOT
22
org.gradle.caching=true
33
org.gradle.configuration-cache=true
44
org.gradle.jvmargs=-Xmx2g
5+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
6+
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

gradle/libs.versions.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[versions]
2+
dokka = "2.0.0"
23
jreleaser = "1.18.0"
34
junit = "5.12.2"
45
kotlin = "2.1.20"
@@ -8,6 +9,8 @@ reactorNetty = "1.2.6-SNAPSHOT"
89
slf4j = "2.0.17"
910

1011
[libraries]
12+
dokka-gradlePlugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" }
13+
dokka-javadocPlugin = { group = "org.jetbrains.dokka-javadoc", name = "org.jetbrains.dokka-javadoc.gradle.plugin", version.ref = "dokka" }
1114
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
1215
junit-platformLauncher = { group = "org.junit.platform", name = "junit-platform-launcher" }
1316
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
@@ -18,4 +21,4 @@ reactorNetty-http = { group = "io.projectreactor.netty", name = "reactor-netty-h
1821
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
1922

2023
[plugins]
21-
jreleaser = { id = "org.jreleaser", version.ref = "jreleaser" }
24+
jreleaser = { id = "org.jreleaser", version.ref = "jreleaser" }

0 commit comments

Comments
 (0)