diff --git a/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt b/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt index 48c89ae5881..21d5586a4fe 100644 --- a/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt +++ b/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt @@ -192,7 +192,7 @@ class KotlinFacetSettings { } } - var implementedModuleName: String? = null + var implementedModuleNames: List = emptyList() var productionOutputPath: String? = null var testOutputPath: String? = null diff --git a/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt b/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt index c37eab577f0..82374598345 100644 --- a/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt +++ b/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt @@ -99,7 +99,12 @@ private fun readV2AndLaterConfig(element: Element): KotlinFacetSettings { val platformName = element.getAttributeValue("platform") val platformKind = TargetPlatformKind.ALL_PLATFORMS.firstOrNull { it.description == platformName } ?: TargetPlatformKind.DEFAULT_PLATFORM element.getChild("implements")?.let { - implementedModuleName = (it.content.firstOrNull() as? Text)?.textTrim + val items = it.getChildren("implement") + implementedModuleNames = if (items.isNotEmpty()) { + items.mapNotNull { (it.content.firstOrNull() as? Text)?.textTrim } + } else { + listOfNotNull((it.content.firstOrNull() as? Text)?.textTrim) + } } element.getChild("compilerSettings")?.let { compilerSettings = CompilerSettings() @@ -237,8 +242,17 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) { if (!useProjectSettings) { element.setAttribute("useProjectSettings", useProjectSettings.toString()) } - implementedModuleName?.let { - element.addContent(Element("implements").apply { addContent(it) }) + if (implementedModuleNames.isNotEmpty()) { + element.addContent( + Element("implements").apply { + val singleModule = implementedModuleNames.singleOrNull() + if (singleModule != null) { + addContent(singleModule) + } else { + implementedModuleNames.map { addContent(Element("implement").apply { addContent(it) }) } + } + } + ) } productionOutputPath?.let { if (it != (compilerArguments as? K2JSCompilerArguments)?.outputFile) {