[JS IR] Support setting custom module name (= unique name)

Required for #KT-36721.
This commit is contained in:
Ilya Matveev
2020-02-21 18:06:58 +07:00
parent d7558112ec
commit e4f4b4eef0
3 changed files with 12 additions and 1 deletions
@@ -128,6 +128,13 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xir-only", description = "Disables pre-IR backend")
var irOnly: Boolean by FreezableVar(false)
@Argument(
value = "-Xir-module-name",
valueDescription = "<name>",
description = "Specify a compilation module name for IR backend"
)
var irModuleName: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xinclude",
valueDescription = "<path>",
@@ -149,7 +149,10 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
val outputFile = File(outputFilePath)
configurationJs.put(CommonConfigurationKeys.MODULE_NAME, FileUtil.getNameWithoutExtension(outputFile))
configurationJs.put(
CommonConfigurationKeys.MODULE_NAME,
arguments.irModuleName ?: FileUtil.getNameWithoutExtension(outputFile)
)
// TODO: in this method at least 3 different compiler configurations are used (original, env.configuration, jsConfig.configuration)
// Such situation seems a bit buggy...
+1
View File
@@ -9,6 +9,7 @@ where advanced options include:
-Xir-dce-driven Perform a more experimental faster dead code elimination
-Xir-dce-print-reachability-info
Print declarations' reachability info to stdout during performing DCE
-Xir-module-name=<name> Specify a compilation module name for IR backend
-Xir-only Disables pre-IR backend
-Xir-produce-js Generates JS file using IR backend. Also disables pre-IR backend
-Xir-produce-klib-dir Generate unpacked KLIB into parent directory of output JS file.