Skip to content

Commit bde662e

Browse files
committed
Use Kotlin 1.9.0
1 parent 82ec542 commit bde662e

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Kotlin-Compile-Testing is compatible with all _local_ compiler versions. It does
110110
However, if your project or any of its dependencies depend directly on compiler artifacts such as `kotlin-compiler-embeddable` or `kotlin-annotation-processing-embeddable` then they have to be the same version as the one used by Kotlin-Compile-Testing or there will be a transitive dependency conflict.
111111

112112

113-
- Current `kotlin-compiler-embeddable` version: `1.8.0`
113+
- Current `kotlin-compiler-embeddable` version: `1.9.0`
114114

115115
Because the internal APIs of the Kotlin compiler often change between versions, we can only support one `kotlin-compiler-embeddable` version at a time.
116116

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
2-
ext.kotlin_version = '1.8.0'
3-
ext.embedded_kotlin_version = '1.8.0'
2+
ext.kotlin_version = '1.9.0'
3+
ext.embedded_kotlin_version = '1.9.0'
44

55
repositories {
66
mavenCentral()

core/src/main/kotlin/com/tschuchort/compiletesting/AbstractKotlinCompilation.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ abstract class AbstractKotlinCompilation<A : CommonCompilerArguments> internal c
3636
/** Working directory for the compilation */
3737
var workingDir: File by default {
3838
val path = Files.createTempDirectory("Kotlin-Compilation")
39-
log("Created temporary working directory at ${path.toAbsolutePath()}")
40-
return@default path.toFile()
39+
val canonicalFile = path.toFile().canonicalFile
40+
log("Created temporary working directory at ${canonicalFile.canonicalPath}")
41+
return@default canonicalFile
4142
}
4243

4344
/**

core/src/main/kotlin/com/tschuchort/compiletesting/KotlinJsCompilation.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.tschuchort.compiletesting
33
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
44
import org.jetbrains.kotlin.cli.js.K2JSCompiler
55
import java.io.*
6+
import java.nio.file.Paths
7+
import kotlin.io.path.nameWithoutExtension
68

79
@Suppress("MemberVisibilityCanBePrivate")
810
class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
@@ -79,6 +81,8 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
7981
args.noStdlib = true
8082

8183
args.moduleKind = "commonjs"
84+
args.outputDir = outputDir.absolutePath // -ir-output-dir
85+
args.moduleName = Paths.get(outputFileName).nameWithoutExtension // -ir-output-name
8286
args.outputFile = File(outputDir, outputFileName).absolutePath
8387
args.sourceMapBaseDirs = jsClasspath().joinToString(separator = File.pathSeparator)
8488
args.libraries = listOfNotNull(kotlinStdLibJsJar).joinToString(separator = ":")
@@ -91,7 +95,7 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
9195
args.irOnly = irOnly
9296
args.irModuleName = irModuleName
9397
args.generateDts = generateDts
94-
args.useDeprecatedLegacyCompiler = useDeprecatedLegacyCompiler
98+
args.forceDeprecatedLegacyCompilerUsage = useDeprecatedLegacyCompiler
9599
}
96100

97101
/** Runs the compilation task */

ksp/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.ksp_version = '1.8.0-1.0.8'
2+
ext.ksp_version = '1.9.0-1.0.13'
33
}
44

55
dependencies {

ksp/src/main/kotlin/com/tschuchort/compiletesting/Ksp.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ import org.jetbrains.kotlin.com.intellij.mock.MockProject
1919
import org.jetbrains.kotlin.com.intellij.psi.PsiTreeChangeAdapter
2020
import org.jetbrains.kotlin.com.intellij.psi.PsiTreeChangeListener
2121
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
22+
import org.jetbrains.kotlin.config.ApiVersion
2223
import org.jetbrains.kotlin.config.CompilerConfiguration
24+
import org.jetbrains.kotlin.config.LanguageVersion
25+
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
2326
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
2427
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
2528
import java.io.File
@@ -169,6 +172,9 @@ private class KspCompileTestingComponentRegistrar(
169172
this.allWarningsAsErrors = this@KspCompileTestingComponentRegistrar.allWarningsAsErrors
170173
this.withCompilation = this@KspCompileTestingComponentRegistrar.withCompilation
171174

175+
this.languageVersionSettings =
176+
LanguageVersionSettingsImpl(LanguageVersion.KOTLIN_1_9, ApiVersion.KOTLIN_1_9)
177+
172178
this.cachesDir = compilation.kspCachesDir.also {
173179
it.deleteRecursively()
174180
it.mkdirs()
@@ -216,7 +222,11 @@ private class KspCompileTestingComponentRegistrar(
216222
val registrar = KspTestExtension(options, providers, messageCollectorBasedKSPLogger)
217223
AnalysisHandlerExtension.registerExtension(project, registrar)
218224
// Dummy extension point; Required by dropPsiCaches().
219-
CoreApplicationEnvironment.registerExtensionPoint(project.extensionArea, PsiTreeChangeListener.EP.name, PsiTreeChangeAdapter::class.java)
225+
CoreApplicationEnvironment.registerExtensionPoint(
226+
project.extensionArea,
227+
PsiTreeChangeListener.EP.name,
228+
PsiTreeChangeAdapter::class.java
229+
)
220230
}
221231
}
222232

0 commit comments

Comments
 (0)