[JS IR] Add per-module output module name

This commit is contained in:
Ilya Goncharov
2021-05-04 15:37:24 +03:00
committed by TeamCityServer
parent 4d7f7fc50f
commit 228c6879f5
7 changed files with 43 additions and 35 deletions
@@ -157,8 +157,8 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xir-per-module", description = "Splits generated .js per-module")
var irPerModule: Boolean by FreezableVar(false)
@Argument(value = "-Xir-per-module-prefix", description = "Adds a custom prefix to the splitted js files")
var irPerModulePrefix: String? by NullableStringFreezableVar(null)
@Argument(value = "-Xir-per-module-output-name", description = "Adds a custom output name to the splitted js files")
var irPerModuleOutputName: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xinclude",
@@ -207,8 +207,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
irFactory = PersistentIrFactory(), // TODO IrFactoryImpl?
outputKlibPath = outputFile.path,
nopack = arguments.irProduceKlibDir,
jsOutputName = moduleName
.substringAfterLast(":"),
jsOutputName = arguments.irPerModuleOutputName,
)
}
@@ -277,7 +276,6 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
relativeRequirePath = true,
propertyLazyInitialization = arguments.irPropertyLazyInitialization,
legacyPropertyAccess = arguments.irLegacyPropertyAccess,
irPerModulePrefix = arguments.irPerModulePrefix
)
val jsCode = if (arguments.irDce && !arguments.irDceDriven) compiledModule.dceJsCode!! else compiledModule.jsCode!!