Skip to content

Commit ca9e529

Browse files
committed
Add Dokka documentation generation and configure publishing settings
1 parent 5328ef4 commit ca9e529

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

buildSrc/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ kotlin {
99
jvmToolchain(11)
1010
}
1111

12+
repositories {
13+
mavenCentral()
14+
gradlePluginPortal()
15+
}
16+
1217
dependencies {
1318
// Add a dependency on the Kotlin Gradle plugin, so that convention plugins can apply it.
1419
implementation(libs.kotlinGradlePlugin)
20+
implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.1.0")
1521
}

buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.jetbrains.kotlin.gradle.plugin.extraProperties
88
plugins {
99
// Apply the Kotlin JVM plugin to add support for Kotlin in JVM projects.
1010
kotlin("jvm")
11+
id("org.jetbrains.dokka")
1112
`maven-publish`
1213
}
1314

@@ -19,14 +20,42 @@ kotlin {
1920
jvmToolchain(11)
2021
}
2122

23+
java {
24+
withSourcesJar()
25+
}
26+
27+
dokka { }
28+
29+
tasks.register<Jar>("dokkaHtmlJar") {
30+
dependsOn(tasks.dokkaGenerateHtml)
31+
from(layout.buildDirectory.dir("dokka/html"))
32+
archiveClassifier.set("javadoc")
33+
}
34+
2235
publishing {
2336
publications {
2437
create<MavenPublication>("maven") {
2538
// Use the default Maven artifact coordinates (group, name, version).
2639
from(components["java"])
40+
artifact(tasks["dokkaHtmlJar"])
41+
2742
groupId = project.group.toString()
2843
artifactId = project.name
29-
version = extraProperties["global.version"]!! as String
44+
45+
version = findProperty("build.version")?.toString()
46+
?: System.getenv("BUILD_VERSION")
47+
?: extraProperties["global.version"]!! as String
48+
}
49+
}
50+
51+
repositories {
52+
maven {
53+
name = "GitHubPackages"
54+
url = uri("https://maven.pkg.github.com/helightdev/krescent")
55+
credentials {
56+
username = project.findProperty("gpr.user")?.toString() ?: System.getenv("USERNAME")
57+
password = project.findProperty("gpr.key")?.toString() ?: System.getenv("TOKEN")
58+
}
3059
}
3160
}
3261
}

0 commit comments

Comments
 (0)