-
Notifications
You must be signed in to change notification settings - Fork 70
Support Kotlin 1.9.0 #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Kotlin 1.9.0 #388
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() { | |
var javaParameters: Boolean = false | ||
|
||
/** Use the IR backend */ | ||
@Deprecated("Since Kotlin 1.9.20 this option is no longer supported by the compiler. It has no effect.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed in this commit. |
||
var useIR: Boolean = false | ||
|
||
/** Use the old JVM backend */ | ||
|
@@ -304,7 +305,6 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() { | |
|
||
args.jvmTarget = jvmTarget | ||
args.javaParameters = javaParameters | ||
args.useIR = useIR | ||
args.useOldBackend = useOldBackend | ||
|
||
if(javaModulePath != null) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ package com.tschuchort.compiletesting | |
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments | ||
import org.jetbrains.kotlin.cli.js.K2JSCompiler | ||
import java.io.* | ||
import java.nio.file.Paths | ||
import kotlin.io.path.nameWithoutExtension | ||
|
||
@Suppress("MemberVisibilityCanBePrivate") | ||
class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() { | ||
|
@@ -79,6 +81,8 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() { | |
args.noStdlib = true | ||
|
||
args.moduleKind = "commonjs" | ||
args.outputDir = outputDir.absolutePath // -ir-output-dir | ||
args.moduleName = Paths.get(outputFileName).nameWithoutExtension // -ir-output-name | ||
args.outputFile = File(outputDir, outputFileName).absolutePath | ||
args.sourceMapBaseDirs = jsClasspath().joinToString(separator = File.pathSeparator) | ||
args.libraries = listOfNotNull(kotlinStdLibJsJar).joinToString(separator = ":") | ||
|
@@ -91,7 +95,7 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() { | |
args.irOnly = irOnly | ||
args.irModuleName = irModuleName | ||
args.generateDts = generateDts | ||
args.useDeprecatedLegacyCompiler = useDeprecatedLegacyCompiler | ||
args.forceDeprecatedLegacyCompilerUsage = useDeprecatedLegacyCompiler | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
/** Runs the compilation task */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,27 +78,6 @@ class KotlinJsCompilationTests { | |
assertThat(jsFile.readText()).contains("function KSource_0() {") | ||
} | ||
|
||
@Test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
fun `Kotlin can access browser window`() { | ||
val source = SourceFile.kotlin("kSource.kt", """ | ||
import kotlinx.browser.window | ||
|
||
fun main(addKotlincArgs: Array<String>) { | ||
println(window.document) | ||
} | ||
""") | ||
|
||
val result = defaultJsCompilerConfig().apply { | ||
sources = listOf(source) | ||
}.compile() | ||
|
||
assertThat(result.exitCode).isEqualTo(ExitCode.OK) | ||
assertThat(result.compiledClassAndResourceFiles).hasSize(1) | ||
val jsFile = result.compiledClassAndResourceFiles[0] | ||
println(jsFile.readText()) | ||
assertThat(jsFile.readText()).contains("println(window.document);") | ||
} | ||
|
||
@Test | ||
fun `detects the plugin provided for compilation via pluginClasspaths property`() { | ||
val result = defaultJsCompilerConfig().apply { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
buildscript { | ||
ext.ksp_version = '1.8.0-1.0.8' | ||
ext.ksp_version = '1.9.10-1.0.13' | ||
} | ||
|
||
dependencies { | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JS compiler calls .canonicalFile internally - at least on MacOS that may be different to the absolute path (
/private/var/…
vs/var/…
), which made the tests fail.