Skip to content

Commit 7a8e5c3

Browse files
lppeddpetertrr
andauthored
Bump Kotlin to 2.2.21 and clean up build scripts (#149)
- Updates Kotlin to 2.2.20-RC2. - Updates Dokka to 2.1.0-Beta. - Replaces Nexus Publish plugin with Vanniktech's plugin. - Simplifies the JaCoCo configuration. - Updates the Reckon plugin to 1.0.0 and enables Gradle's configuration cache. Closes: #148 Closes: #113 --------- Co-authored-by: Peter Trifanov <peter.trifanov@gmail.com>
1 parent 15abe10 commit 7a8e5c3

File tree

12 files changed

+264
-1852
lines changed

12 files changed

+264
-1852
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
78
env:
8-
GPG_SEC: ${{ secrets.PGP_SEC }}
9-
GPG_PASSWORD: ${{ secrets.PGP_PASSWORD }}
10-
OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
11-
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
9+
# See https://vanniktech.github.io/gradle-maven-publish-plugin/central for the list of required properties
10+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ vars.PGP_KEY_ID }}
11+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.PGP_SEC }}
12+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.PGP_PASSWORD }}
13+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_PORTAL_USER }}
14+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PORTAL_PASSWORD }}
1215

1316
jobs:
1417
release:
@@ -35,4 +38,4 @@ jobs:
3538
with:
3639
gradle-version: wrapper
3740
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
38-
- run: ./gradlew publishToSonatype closeSonatypeStagingRepository
41+
- run: ./gradlew publishToMavenCentral

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License](https://img.shields.io/github/license/petertrr/kotlin-multiplatform-diff)](https://github.com/petertrr/kotlin-multiplatform-diff/blob/main/LICENSE)
66
[![Maven Central](https://img.shields.io/maven-central/v/io.github.petertrr/kotlin-multiplatform-diff)](https://mvnrepository.com/artifact/io.github.petertrr)
77
[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)
8-
[![Kotlin](https://img.shields.io/badge/kotlin-2.1.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
8+
[![Kotlin](https://img.shields.io/badge/kotlin-2.2.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
99

1010
This is a port of [java-diff-utils](https://github.com/java-diff-utils/java-diff-utils) to Kotlin with multiplatform support.
1111
All credit for the implementation goes to the original authors.

build.gradle.kts

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import io.github.petertrr.configurePublishing
2-
import io.github.petertrr.ext.booleanProperty
31
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
42
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
53
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
64
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
75

86
plugins {
9-
kotlin("multiplatform")
7+
alias(libs.plugins.kotlinMultiplatform)
8+
alias(libs.plugins.dokka)
109
alias(libs.plugins.detekt)
11-
id("jacoco-convention")
10+
alias(libs.plugins.vanniktech)
11+
jacoco
1212
}
1313

1414
group = "io.github.petertrr"
@@ -20,10 +20,9 @@ dependencies {
2020

2121
kotlin {
2222
explicitApi()
23-
2423
compilerOptions {
25-
apiVersion = KotlinVersion.KOTLIN_2_1
26-
languageVersion = KotlinVersion.KOTLIN_2_1
24+
apiVersion = KotlinVersion.KOTLIN_2_2
25+
languageVersion = KotlinVersion.KOTLIN_2_2
2726
}
2827

2928
jvm {
@@ -117,16 +116,91 @@ kotlin {
117116
}
118117
}
119118

120-
configurePublishing()
119+
mavenPublishing {
120+
coordinates(
121+
groupId = project.group.toString(),
122+
artifactId = project.name,
123+
version = project.version.toString(),
124+
)
125+
126+
// Publishing to Maven Central requires the following Gradle properties:
127+
// mavenCentralUsername=central_username
128+
// mavenCentralPassword=central_password
129+
publishToMavenCentral()
130+
131+
// Signing is enabled only if the key is actually provided.
132+
// We do not want missing signing info to block publication to local.
133+
val signingKey = project.providers.gradleProperty("signingInMemoryKey")
134+
135+
if (signingKey.isPresent) {
136+
// Signing requires the following Gradle properties:
137+
// signingInMemoryKeyId=pgp_key_id
138+
// signingInMemoryKey=pgp_key
139+
// signingInMemoryKeyPassword=pgp_key_password
140+
signAllPublications()
141+
}
142+
143+
pom {
144+
name.set(project.name)
145+
description.set(project.description)
146+
url.set("https://github.com/petertrr/kotlin-multiplatform-diff")
147+
148+
licenses {
149+
license {
150+
name.set("The Apache Software License, Version 2.0")
151+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
152+
distribution.set("repo")
153+
}
154+
}
155+
156+
developers {
157+
developer {
158+
id.set("petertrr")
159+
name.set("Petr Trifanov")
160+
email.set("peter.trifanov@gmail.com")
161+
}
162+
}
163+
164+
scm {
165+
url.set("https://github.com/petertrr/kotlin-multiplatform-diff")
166+
connection.set("scm:git:git://github.com/petertrr/kotlin-multiplatform-diff.git")
167+
}
168+
}
169+
}
170+
171+
jacoco {
172+
toolVersion = "0.8.13"
173+
}
121174

122175
detekt {
123176
buildUponDefaultConfig = true
124177
config.setFrom(files("detekt.yml"))
125-
autoCorrect = booleanProperty("detektAutoCorrect", default = true)
178+
autoCorrect = project.providers.gradleProperty("detektAutoCorrect").map(String::toBoolean).getOrElse(true)
126179
}
127180

128181
tasks {
129182
check {
130183
dependsOn(detekt)
131184
}
185+
186+
val jvmTest = named<Test>("jvmTest")
187+
val jacocoReport = register<JacocoReport>("jacocoTestReport") {
188+
dependsOn(jvmTest)
189+
190+
val commonMainSources = kotlin.sourceSets["commonMain"].kotlin.sourceDirectories
191+
val jvmMainSources = kotlin.sourceSets["jvmMain"].kotlin.sourceDirectories
192+
193+
sourceDirectories.setFrom(files(commonMainSources, jvmMainSources))
194+
classDirectories.setFrom(layout.buildDirectory.file("classes/kotlin/jvm/main"))
195+
executionData.setFrom(layout.buildDirectory.files("jacoco/jvmTest.exec"))
196+
197+
reports {
198+
xml.required = true
199+
html.required = true
200+
}
201+
}
202+
203+
jvmTest.configure {
204+
finalizedBy(jacocoReport)
205+
}
132206
}

buildSrc/build.gradle.kts

Lines changed: 0 additions & 9 deletions
This file was deleted.

buildSrc/settings.gradle.kts

Lines changed: 0 additions & 13 deletions
This file was deleted.

buildSrc/src/main/kotlin/io/github/petertrr/PublishingConfiguration.kt

Lines changed: 0 additions & 111 deletions
This file was deleted.

buildSrc/src/main/kotlin/io/github/petertrr/ext/Project.ext.kt

Lines changed: 0 additions & 12 deletions
This file was deleted.

buildSrc/src/main/kotlin/io/github/petertrr/jacoco-convention.gradle.kts

Lines changed: 0 additions & 39 deletions
This file was deleted.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#########################
22
# Gradle settings
33
#########################
4-
org.gradle.jvmargs = -Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
4+
org.gradle.jvmargs = -Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
55
org.gradle.parallel = true
66
org.gradle.caching = true
7-
org.gradle.configuration-cache = false
7+
org.gradle.configuration-cache = true
88

99
#########################
1010
# Kotlin settings

gradle/libs.versions.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
[versions]
2-
kotlin = "2.1.20"
2+
kotlin = "2.2.21"
33
detekt = "1.23.8"
4-
dokka = "1.9.20"
5-
nexus = "2.0.0"
4+
dokka = "2.1.0"
5+
vanniktech = "0.34.0"
66

77
[plugins]
8+
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
9+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
810
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
11+
vanniktech = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech" }
912

1013
[libraries]
1114
detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" }
12-
13-
# Gradle plugins
14-
kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
15-
dokka-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" }
16-
nexus-plugin = { group = "io.github.gradle-nexus", name = "publish-plugin", version.ref = "nexus" }

0 commit comments

Comments
 (0)