mirror of
https://github.com/apple/pkl.git
synced 2026-07-15 17:42:46 +02:00
Update Kotlin to 2.0 (#900)
- update Kotlin from 1.7.10 to 2.0.21
- Kotlin 1.6 dependencies in Gradle lock files are expected because kotlinc,
which is also used by some tests, internally uses some 1.6 dependencies
for backwards compatibility reasons.
- update kotlinx-html and kotlinx-serialization
- adapt Kotlin code where necessary
- use Kotlin stdlib Path APIs where possible
- fix IntelliJ Kotlin inspection warnings
- reformat code with `./gradlew spotlessApply`
- ktfmt adds lots of trailing commas
- Add workaround to fix IntelliJ "unresolved reference" errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,13 @@ sourceSets {
|
||||
test {
|
||||
// Remove Gradle distribution JARs from test compile classpath.
|
||||
// This prevents a conflict between Gradle's and Pkl's Kotlin versions.
|
||||
compileClasspath = compileClasspath.filter { !(it.path.contains("dists")) }
|
||||
//
|
||||
// For some reason, IntelliJ import turns pklCommonsTest into a runtime dependency
|
||||
// if `compileClasspath` is filtered, causing "unresolved reference" errors in IntelliJ.
|
||||
// As a workaround, don't perform filtering for IntelliJ (import).
|
||||
if (System.getProperty("idea.sync.active") == null) {
|
||||
compileClasspath = compileClasspath.filter { !(it.path.contains("dists")) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,4 +105,6 @@ signing {
|
||||
// (Apparently, gradle-api.jar now contains metadata that causes kotlinc to enforce Gradle's Kotlin
|
||||
// version.)
|
||||
// A more robust solution would be to port plugin tests to Java.
|
||||
tasks.compileTestKotlin { kotlinOptions { freeCompilerArgs += "-Xskip-metadata-version-check" } }
|
||||
tasks.compileTestKotlin {
|
||||
compilerOptions { freeCompilerArgs.add("-Xskip-metadata-version-check") }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user