Skip to content

Commit

Permalink
Update to the latest kotlin K2 compiler (#338)
Browse files Browse the repository at this point in the history
Signed-off-by: Philip K. Warren <pwarren@buf.build>
  • Loading branch information
pkwarren authored Oct 11, 2024
1 parent edf3d55 commit bdf06fe
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MAKEFLAGS += --no-print-directory
BIN := .tmp/bin
CACHE := .tmp/cache
LICENSE_HEADER_YEAR_RANGE := 2022-2023
LICENSE_HEADER_VERSION := v1.34.0
LICENSE_HEADER_VERSION := v1.45.0
CONFORMANCE_VERSION := v1.0.3
PROTOC_VERSION ?= $(shell yq '.versions.protobuf' gradle/libs.versions.toml | cut -d'.' -f2-)
ifeq ($(PROTOC_VERSION),)
Expand Down
16 changes: 9 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
alias(libs.plugins.git)
Expand Down Expand Up @@ -128,13 +130,13 @@ allprojects {
}

subprojects {
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.6"
apiVersion = "1.6"
tasks.withType<KotlinJvmCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
languageVersion.set(KotlinVersion.KOTLIN_1_7)
apiVersion.set(KotlinVersion.KOTLIN_1_7)
if (JavaVersion.current().isJava9Compatible && project.name != "android") {
freeCompilerArgs += "-Xjdk-release=1.8"
freeCompilerArgs.add("-Xjdk-release=1.8")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions conformance/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ plugins {

tasks {
compileKotlin {
kotlinOptions {
compilerOptions {
// Generated Kotlin code for protobuf uses OptIn annotation
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions conformance/client/google-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ application {

tasks {
compileKotlin {
kotlinOptions {
compilerOptions {
// Generated Kotlin code for protobuf uses OptIn annotation
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
jar {
Expand Down
4 changes: 2 additions & 2 deletions conformance/client/google-javalite/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ application {

tasks {
compileKotlin {
kotlinOptions {
compilerOptions {
// Generated Kotlin code for protobuf uses RequiresOptIn annotation
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
jar {
Expand Down
4 changes: 2 additions & 2 deletions examples/generated-google-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {

tasks {
compileKotlin {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/generated-google-javalite/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {

tasks {
compileKotlin {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ assertj = "3.26.3"
coroutines = "1.9.0"
dokka = "1.9.20"
junit = "4.13.2"
kotlin = "1.9.24"
kotlin = "2.0.20"
kotlinpoet = "1.18.1"
mavenplugin = "0.29.0"
moshi = "1.15.1"
Expand Down Expand Up @@ -58,5 +58,5 @@ testcontainers = { module = "org.testcontainers:testcontainers", version = "1.20

[plugins]
git = { id = "com.palantir.git-version", version = "3.1.0" }
ksp = { id = "com.google.devtools.ksp", version = "1.9.24-1.0.20" }
ksp = { id = "com.google.devtools.ksp", version = "2.0.20-1.0.25" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }

0 comments on commit bdf06fe

Please sign in to comment.