[Wasm] Add kotlin wasm wasi mode compiler flag

This commit is contained in:
Igor Yakovlev
2023-06-29 16:11:21 +02:00
committed by Space Team
parent 7c7aa98875
commit 750653e4b3
6 changed files with 33 additions and 0 deletions
@@ -72,6 +72,7 @@ fun copyK2JSCompilerArguments(from: K2JSCompilerArguments, to: K2JSCompilerArgum
to.wasmEnableAsserts = from.wasmEnableAsserts
to.wasmGenerateWat = from.wasmGenerateWat
to.wasmKClassFqn = from.wasmKClassFqn
to.wasmTarget = from.wasmTarget
return to
}
@@ -623,6 +623,13 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
field = value
}
@Argument(value = "-Xwasm-target", description = "Set up Wasm target (wasm-js or wasm-wasi)")
var wasmTarget: String? = null
set(value) {
checkFrozen()
field = if (value.isNullOrEmpty()) null else value
}
@Argument(
value = "-Xforce-deprecated-legacy-compiler-usage",
description = "The flag is used only for our inner infrastructure. It will be removed soon, so it's unsafe to use it nowadays."
@@ -169,6 +169,8 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
configuration.put(JSConfigurationKeys.WASM_ENABLE_ARRAY_RANGE_CHECKS, arguments.wasmEnableArrayRangeChecks)
configuration.put(JSConfigurationKeys.WASM_ENABLE_ASSERTS, arguments.wasmEnableAsserts)
configuration.put(JSConfigurationKeys.WASM_GENERATE_WAT, arguments.wasmGenerateWat)
configuration.putIfNotNull(JSConfigurationKeys.WASM_TARGET, arguments.wasmTarget?.let(WasmTarget::fromName))
configuration.put(JSConfigurationKeys.OPTIMIZE_GENERATED_JS, arguments.optimizeGeneratedJs)
val commonSourcesArray = arguments.commonSources