Skip to content

Commit

Permalink
Kotlin 1.9.20. Disable k2 due to failing tests. Java 21 toolchain.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Nov 9, 2023
1 parent ce47a3b commit 18c3d03
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
44 changes: 24 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import com.google.cloud.tools.jib.gradle.BuildImageTask
import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.kotlin.jvm)
Expand Down Expand Up @@ -58,9 +57,30 @@ dependencies {

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(20))
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.AZUL)
}
compilerOptions {
// languageVersion.set(KotlinVersion.KOTLIN_2_0) TODO enable once tests pass with K2
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-Xjsr305=strict",
"-Xcontext-receivers",
)
}
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
}

configurations.configureEach {
resolutionStrategy.eachDependency {
if (this@configureEach.name == "detekt" && requested.group == "org.jetbrains.kotlin") {
useVersion("1.9.10")
}
}
}

allprojects {
Expand All @@ -72,29 +92,13 @@ allprojects {
}
tasks.withType<Detekt>().configureEach {
reports {
jvmTarget = JvmTarget.JVM_20.target // TODO remove once detekt supports JVM 21 bytecode
html.outputLocation.set(file("build/reports/detekt/${project.name}.html"))
}
}
dependencies.add("detektPlugins", libs.detektFormatting)
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
languageVersion.set(KotlinVersion.KOTLIN_2_0)
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-Xjsr305=strict",
"-Xcontext-receivers",
"-Xbackend-threads=0",
)
}
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
}

fun Project.envOrProp(name: String): String {
return providers.environmentVariable(name).orNull
?: providers.gradleProperty(name).orNull
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ org.gradle.configuration-cache-problems=warn

# Kotlin code style
kotlin.code.style=official
kotlin.experimental.tryK2=true
4 changes: 1 addition & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[versions]
kotlin = "1.9.10"
kotlin = "1.9.20"
spring-boot = "3.1.5"
spring-dependencyManagement = "1.1.3"
jib = "3.4.0"
ktor = "2.3.6"
dgsBom = "8.0.1"
dgsCodegen = "6.0.3"
kotlinx-coroutines = "1.7.2"
kotlinx-serialization = "1.5.1"
detekt = "1.23.3"
apacheCommonsText = "1.10.0"
caffeine = "3.1.8"
Expand Down

0 comments on commit 18c3d03

Please sign in to comment.