Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 9dbaf57

Browse files
authored
Update to K2 + modernize (#111)
* Update deps * Fix illegal smartcast Correctly caught in K2 * Add .kotlin to ignored * Enable more gradle APIs * nit * Regenerate API * Beta4 * Beta5 * RC1 * Spotless * RC2 * RC3 * Gradle 8.7 * 2.0 final * Final versions * 2.0.20 + gradle 8.10 * moshix update * JDK 22
1 parent eaae632 commit 9dbaf57

File tree

12 files changed

+442
-425
lines changed

12 files changed

+442
-425
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
uses: actions/setup-java@v4
3232
with:
3333
distribution: 'zulu'
34-
java-version: '21'
34+
java-version: '22'
3535

3636
- name: Setup Gradle
3737
uses: gradle/actions/setup-gradle@v3

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.gradle
2+
.kotlin/
23
local.properties
34
.idea
45
!/.idea/codeStyles

api/kotlin-cli-util.api

Lines changed: 410 additions & 410 deletions
Large diffs are not rendered by default.

build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spotless {
5757
}
5858
}
5959

60-
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } }
60+
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(22)) } }
6161

6262
tasks.withType<JavaCompile>().configureEach {
6363
options.release.set(libs.versions.jvmTarget.get().toInt())
@@ -66,7 +66,7 @@ tasks.withType<JavaCompile>().configureEach {
6666
tasks.withType<Detekt>().configureEach { jvmTarget = libs.versions.jvmTarget.get() }
6767

6868
tasks.withType<DokkaTask>().configureEach {
69-
outputDirectory.set(rootDir.resolve("../docs/0.x"))
69+
outputDirectory.set(rootProject.layout.projectDirectory.dir("docs/2.x"))
7070
dokkaSourceSets.configureEach { skipDeprecated.set(true) }
7171
}
7272

@@ -85,11 +85,13 @@ kotlin {
8585
}
8686
}
8787

88+
lint { baseline = file("lint-baseline.xml") }
89+
8890
moshi { enableSealed.set(true) }
8991

9092
// We have a couple flaky tests on CI right now
9193
if (System.getenv("CI") != null) {
92-
tasks.withType<Test>().configureEach {
94+
tasks.test {
9395
retry {
9496
maxRetries.set(2)
9597
maxFailures.set(20)

gradle.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@ org.gradle.jvmargs=-Xms1g -Xmx2g -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemor
77

88
org.gradle.parallel=true
99
org.gradle.caching=true
10+
org.gradle.configureondemand=true
11+
org.gradle.configuration-cache=true
1012
moshix.generateProguardRules=false
1113

14+
# Use new K2 UAST for lint
15+
android.lint.useK2Ugast=true
16+
android.experimental.lint.missingBaselineIsEmptyBaseline=true
17+
18+
# Use KSP2
19+
ksp.useKSP2=true
20+
1221
POM_NAME=Kotlin CLI Util
1322
POM_ARTIFACT_ID=kotlin-cli-util
1423
POM_PACKAGING=jar

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[versions]
2-
kotlin = "1.9.24"
3-
kotlinx-serialization = "1.6.3"
4-
ksp = "1.9.24-1.0.20"
2+
kotlin = "2.0.20"
3+
kotlinx-serialization = "1.7.0"
4+
ksp = "2.0.20-1.0.24"
55
ktfmt = "0.49"
66
jvmTarget = "17"
7-
moshix = "0.26.0"
7+
moshix = "0.28.0"
88
moshi = "1.15.1"
99
tikxml = "0.8.15"
1010
xmlutil = "0.86.3"
1111

1212
[plugins]
1313
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.6" }
1414
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
15-
lint = { id = "com.android.lint", version = "8.4.1" }
15+
lint = { id = "com.android.lint", version = "8.7.0-alpha08" }
1616
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.29.0" }
1717
moshix = { id = "dev.zacsweers.moshix", version.ref = "moshix" }
1818
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.jar

121 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
8688
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87-
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90+
' "$PWD" ) || exit
8891

8992
# Use the maximum available, or set MAX_FD != -1 to use that value.
9093
MAX_FD=maximum

gradlew.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@rem See the License for the specific language governing permissions and
1414
@rem limitations under the License.
1515
@rem
16+
@rem SPDX-License-Identifier: Apache-2.0
17+
@rem
1618

1719
@if "%DEBUG%"=="" @echo off
1820
@rem ##########################################################################

release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ git commit -am "Prepare for release $NEW_VERSION."
7474
git tag -a "$NEW_VERSION" -m "Version $NEW_VERSION"
7575

7676
# Publish
77-
./gradlew publish -x dokkaHtml
77+
./gradlew publish -x dokkaHtml --no-configuration-cache
7878

7979
# Prepare next snapshot
8080
echo "Setting next snapshot version $NEXT_SNAPSHOT_VERSION"

src/main/kotlin/slack/cli/buildkite/JsonElementKamlSerializers.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ private object JsonLiteralSerializer : KSerializer<JsonLiteral> {
173173
return encoder.encodeString(value.content)
174174
}
175175

176-
if (value.coerceToInlineType != null) {
177-
return encoder.encodeInline(value.coerceToInlineType).encodeString(value.content)
176+
value.coerceToInlineType?.let {
177+
return encoder.encodeInline(it).encodeString(value.content)
178178
}
179179

180180
// use .content instead of .longOrNull as latter can process exponential notation,

0 commit comments

Comments
 (0)