Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to K2 #111

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle
.kotlin/
local.properties
.idea
!/.idea/codeStyles
Expand Down
820 changes: 410 additions & 410 deletions api/kotlin-cli-util.api

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tasks.withType<JavaCompile>().configureEach {
tasks.withType<Detekt>().configureEach { jvmTarget = libs.versions.jvmTarget.get() }

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

Expand All @@ -85,11 +85,13 @@ kotlin {
}
}

lint { baseline = file("lint-baseline.xml") }

moshi { enableSealed.set(true) }

// We have a couple flaky tests on CI right now
if (System.getenv("CI") != null) {
tasks.withType<Test>().configureEach {
tasks.test {
retry {
maxRetries.set(2)
maxFailures.set(20)
Expand Down
9 changes: 9 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ org.gradle.jvmargs=-Xms1g -Xmx2g -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemor

org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
moshix.generateProguardRules=false

# Use new K2 UAST for lint
android.lint.useK2Ugast=true
android.experimental.lint.missingBaselineIsEmptyBaseline=true

# Use KSP2
ksp.useKSP2=true

POM_NAME=Kotlin CLI Util
POM_ARTIFACT_ID=kotlin-cli-util
POM_PACKAGING=jar
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
[versions]
kotlin = "1.9.24"
kotlin = "2.0.0"
kotlinx-serialization = "1.6.3"
ZacSweers marked this conversation as resolved.
Show resolved Hide resolved
ksp = "1.9.24-1.0.20"
ksp = "2.0.0-1.0.21"
ZacSweers marked this conversation as resolved.
Show resolved Hide resolved
ktfmt = "0.49"
jvmTarget = "17"
moshix = "0.26.0"
moshix = "0.27.0-alpha01"
ZacSweers marked this conversation as resolved.
Show resolved Hide resolved
moshi = "1.15.1"
tikxml = "0.8.15"
xmlutil = "0.86.3"

[plugins]
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.6" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
lint = { id = "com.android.lint", version = "8.4.0" }
lint = { id = "com.android.lint", version = "8.6.0-alpha02" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.28.0" }
moshix = { id = "dev.zacsweers.moshix", version.ref = "moshix" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.14.0" }
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.15.0-Beta.2" }
retry = { id = "org.gradle.test-retry", version = "1.5.9" }

[libraries]
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ git commit -am "Prepare for release $NEW_VERSION."
git tag -a "$NEW_VERSION" -m "Version $NEW_VERSION"

# Publish
./gradlew publish -x dokkaHtml
./gradlew publish -x dokkaHtml --no-configuration-cache

# Prepare next snapshot
echo "Setting next snapshot version $NEXT_SNAPSHOT_VERSION"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ private object JsonLiteralSerializer : KSerializer<JsonLiteral> {
return encoder.encodeString(value.content)
}

if (value.coerceToInlineType != null) {
return encoder.encodeInline(value.coerceToInlineType).encodeString(value.content)
value.coerceToInlineType?.let {
return encoder.encodeInline(it).encodeString(value.content)
}

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