Skip to content

Commit

Permalink
Merge pull request #16 from usefulness/updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski authored Nov 12, 2023
2 parents c5da8c4 + 55883b5 commit ffb4fef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ maven-kotlin = "1.9.20"
maven-junit = "5.10.1"
maven-assertj = "3.24.2"
maven-binarycompatiblity = "0.13.2"
maven-dokka = "1.9.10"

[libraries]
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "maven-junit" }
Expand All @@ -20,6 +21,7 @@ com-squareup-kotlinpoet = "com.squareup:kotlinpoet:1.14.2"
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "maven-kotlin-serialization" }
kotlinx-serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "maven-kotlin-serialization" }
com-squareup-okio = "com.squareup.okio:okio:3.6.0"
jetbrains-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "maven-dokka" }

[plugins]
starter-config = { id = "com.starter.config", version.ref = "gradle-starter" }
Expand Down
4 changes: 4 additions & 0 deletions gradle/plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ tasks.withType(KotlinCompile).configureEach {
kotlinOptions.jvmTarget = targetJavaVersion
}

dependencies {
implementation libs.jetbrains.dokka
}

gradlePlugin {
plugins {
publishingPlugin {
Expand Down
16 changes: 16 additions & 0 deletions gradle/plugins/src/main/kotlin/PublishingPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import org.gradle.api.plugins.ExtensionContainer
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.jvm.tasks.Jar
import org.gradle.plugin.devel.GradlePluginDevelopmentExtension
import org.gradle.plugins.signing.SigningExtension
import org.jetbrains.dokka.gradle.DokkaTask

class PublishingPlugin : Plugin<Project> {

Expand All @@ -14,6 +16,7 @@ class PublishingPlugin : Plugin<Project> {
if (findConfig("SIGNING_PASSWORD").isNotEmpty()) {
pluginManager.apply("signing")
}

extensions.configure<PublishingExtension> {
with(repositories) {
maven { maven ->
Expand Down Expand Up @@ -59,7 +62,20 @@ class PublishingPlugin : Plugin<Project> {
pluginManager.withPlugin("java") {
extensions.configure<JavaPluginExtension> {
withSourcesJar()
withJavadocJar()
}

pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
pluginManager.apply("org.jetbrains.dokka")

tasks.withType(DokkaTask::class.java).configureEach { dokkaTask ->
dokkaTask.notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/1217")
}
tasks.named("javadocJar", Jar::class.java) { javadocJar ->
javadocJar.from(tasks.named("dokkaJavadoc"))
}
}

extensions.configure<PublishingExtension> {
publications.configureEach { publication ->
(publication as? MavenPublication)?.pom { pom ->
Expand Down

0 comments on commit ffb4fef

Please sign in to comment.