committed by
Sergey Igushkin
parent
350e68b20f
commit
5b1ea61cd1
@@ -112,6 +112,12 @@ var CommonCompilerArguments.apiVersionView: VersionView
|
||||
autoAdvanceApiVersion = value == VersionView.LatestStable
|
||||
}
|
||||
|
||||
enum class KotlinModuleKind {
|
||||
DEFAULT,
|
||||
SOURCE_SET_HOLDER,
|
||||
COMPILATION_AND_SOURCE_SET_HOLDER
|
||||
}
|
||||
|
||||
class KotlinFacetSettings {
|
||||
companion object {
|
||||
// Increment this when making serialization-incompatible changes to configuration data
|
||||
@@ -196,6 +202,9 @@ class KotlinFacetSettings {
|
||||
|
||||
var productionOutputPath: String? = null
|
||||
var testOutputPath: String? = null
|
||||
|
||||
var kind: KotlinModuleKind = KotlinModuleKind.DEFAULT
|
||||
var sourceSetNames: List<String> = emptyList()
|
||||
}
|
||||
|
||||
fun TargetPlatformKind<*>.createCompilerArguments(init: CommonCompilerArguments.() -> Unit = {}): CommonCompilerArguments {
|
||||
|
||||
@@ -111,6 +111,20 @@ private fun readV2AndLaterConfig(element: Element): KotlinFacetSettings {
|
||||
listOfNotNull((it.content.firstOrNull() as? Text)?.textTrim)
|
||||
}
|
||||
}
|
||||
element.getChild("sourceSets")?.let {
|
||||
val items = it.getChildren("sourceSet")
|
||||
sourceSetNames = items.mapNotNull { (it.content.firstOrNull() as? Text)?.textTrim }
|
||||
}
|
||||
kind = element.getChild("newMppModelJpsModuleKind")?.let {
|
||||
val kindName = (it.content.firstOrNull() as? Text)?.textTrim
|
||||
if (kindName != null) {
|
||||
try {
|
||||
KotlinModuleKind.valueOf(kindName)
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
} else null
|
||||
} ?: KotlinModuleKind.DEFAULT
|
||||
element.getChild("compilerSettings")?.let {
|
||||
compilerSettings = CompilerSettings()
|
||||
XmlSerializer.deserializeInto(compilerSettings!!, it)
|
||||
@@ -259,6 +273,16 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
|
||||
}
|
||||
)
|
||||
}
|
||||
if (sourceSetNames.isNotEmpty()) {
|
||||
element.addContent(
|
||||
Element("sourceSets").apply {
|
||||
sourceSetNames.map { addContent(Element("sourceSet").apply { addContent(it) }) }
|
||||
}
|
||||
)
|
||||
}
|
||||
if (kind != KotlinModuleKind.DEFAULT) {
|
||||
element.addContent(Element("newMppModelJpsModuleKind").apply { addContent(kind.name) })
|
||||
}
|
||||
productionOutputPath?.let {
|
||||
if (it != (compilerArguments as? K2JSCompilerArguments)?.outputFile) {
|
||||
element.addContent(Element("productionOutputPath").apply { addContent(PathUtil.toSystemIndependentName(it)) })
|
||||
|
||||
Reference in New Issue
Block a user