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

Update to K2 + modernize #111

Merged
merged 24 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
java-version: '22'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
Expand Down
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.

8 changes: 5 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spotless {
}
}

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

tasks.withType<JavaCompile>().configureEach {
options.release.set(libs.versions.jvmTarget.get().toInt())
Expand All @@ -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,18 +1,18 @@
[versions]
kotlin = "1.9.24"
kotlinx-serialization = "1.6.3"
ksp = "1.9.24-1.0.20"
kotlin = "2.0.20"
kotlinx-serialization = "1.7.0"
ksp = "2.0.20-1.0.24"
ktfmt = "0.49"
jvmTarget = "17"
moshix = "0.26.0"
moshix = "0.28.0"
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.1" }
lint = { id = "com.android.lint", version = "8.7.0-alpha08" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.29.0" }
moshix = { id = "dev.zacsweers.moshix", version.ref = "moshix" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
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.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

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

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
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