diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt index 1bec642f53e..6840434f2cf 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt @@ -68,6 +68,13 @@ fun getCInteropArguments(): List { return (options + getCommonInteropArguments()) } +fun getJSInteropArguments(): List { + val options = listOf( + OptionDescriptor(ArgType.Choice(listOf("wasm32")), "target", description = "wasm target to compile to", defaultValue = "wasm32") + ) + return (options + getCommonInteropArguments()) +} + internal fun warn(msg: String) { println("warning: $msg") } diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/wasm/StubGenerator.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/wasm/StubGenerator.kt index b7daa0ee7bf..c0e8f19293d 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/wasm/StubGenerator.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/wasm/StubGenerator.kt @@ -4,7 +4,7 @@ import org.jetbrains.kotlin.konan.file.File import org.jetbrains.kotlin.native.interop.gen.argsToCompiler import org.jetbrains.kotlin.native.interop.gen.wasm.idl.* import org.jetbrains.kliopt.ArgParser -import org.jetbrains.kotlin.native.interop.tool.getCommonInteropArguments +import org.jetbrains.kotlin.native.interop.tool.getJSInteropArguments import org.jetbrains.kotlin.native.interop.tool.getValuesAsArray fun kotlinHeader(packageName: String): String { @@ -393,7 +393,7 @@ const val idlMathPackage = "kotlinx.interop.wasm.math" const val idlDomPackage = "kotlinx.interop.wasm.dom" fun processIdlLib(args: Array, additionalArgs: Map = mapOf()): Array? { - val argParser = ArgParser(getCommonInteropArguments(), useDefaultHelpShortName = false) + val argParser = ArgParser(getJSInteropArguments(), useDefaultHelpShortName = false) if (!argParser.parse(args)) return null // TODO: Refactor me. diff --git a/samples/html5Canvas/build.gradle b/samples/html5Canvas/build.gradle index 69d81e42087..ffc57db4fce 100644 --- a/samples/html5Canvas/build.gradle +++ b/samples/html5Canvas/build.gradle @@ -31,7 +31,7 @@ kotlin { } httpServerMain { dependencies { - implementation 'io.ktor:ktor-server-netty:1.0.1' + implementation 'io.ktor:ktor-server-netty:1.1.2' } } } diff --git a/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt b/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt index b02c7962612..5d1cd3d4fa0 100644 --- a/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt +++ b/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.native.interop.tool.* // The interaction of interop and the compler should be streamlined. fun invokeInterop(flavor: String, args: Array): Array? { - val argParser = ArgParser(if (flavor == "native") getCInteropArguments() else getCommonInteropArguments(), + val argParser = ArgParser(if (flavor == "native") getCInteropArguments() else getJSInteropArguments(), useDefaultHelpShortName = false) if (!argParser.parse(args)) return null @@ -40,12 +40,10 @@ fun invokeInterop(flavor: String, args: Array): Array? { val cstubsName ="cstubs" val libraries = argParser.getAll("library") ?: listOf() val repos = argParser.getAll("repo") ?: listOf() - var targetName = "wasm32" + val targetRequest = argParser.get("target")!! + val target = PlatformManager().targetManager(targetRequest).target if (flavor == "native") { - val targetRequest = argParser.get("target")!! - val target = PlatformManager().targetManager(targetRequest).target - targetName = target.visibleName val resolver = defaultResolver( repos, libraries.filter { it.contains(File.separator) }, @@ -78,7 +76,7 @@ fun invokeInterop(flavor: String, args: Array): Array? { generatedDir.path, "-produce", "library", "-o", outputFileName, - "-target", targetName, + "-target", target.visibleName, "-manifest", manifest.path, "-Xtemporary-files-dir=$temporaryFilesDir") + nativeStubs +