[CLI] Drop CommonCompilerArguments.coroutinesState

Original commit: e991c9d476
This commit is contained in:
Dmitriy Novozhilov
2020-12-02 13:22:40 +03:00
committed by TeamCityServer
parent 14d3667a8e
commit 377b78d9e6
@@ -195,19 +195,7 @@ private fun readElementsList(element: Element, rootElementName: String, elementN
}
private fun readV2Config(element: Element): KotlinFacetSettings {
return readV2AndLaterConfig(element).apply {
element.getChild("compilerArguments")?.children?.let { args ->
when {
args.any { arg -> arg.attributes[0].value == "coroutinesEnable" && arg.attributes[1].booleanValue } ->
compilerArguments!!.coroutinesState = CommonCompilerArguments.ENABLE
args.any { arg -> arg.attributes[0].value == "coroutinesWarn" && arg.attributes[1].booleanValue } ->
compilerArguments!!.coroutinesState = CommonCompilerArguments.WARN
args.any { arg -> arg.attributes[0].value == "coroutinesError" && arg.attributes[1].booleanValue } ->
compilerArguments!!.coroutinesState = CommonCompilerArguments.ERROR
else -> compilerArguments!!.coroutinesState = CommonCompilerArguments.DEFAULT
}
}
}
return readV2AndLaterConfig(element)
}
private fun readLatestConfig(element: Element): KotlinFacetSettings {
@@ -408,35 +396,10 @@ fun Element.dropVersionsIfNecessary(settings: CommonCompilerArguments) {
}
}
// Special treatment of v2 may be dropped after transition to IDEA 172
private fun KotlinFacetSettings.writeV2Config(element: Element) {
writeLatestConfig(element)
element.getChild("compilerArguments")?.let {
it.getOption("coroutinesState")?.detach()
val coroutineOption = when (compilerArguments?.coroutinesState) {
CommonCompilerArguments.ENABLE -> "coroutinesEnable"
CommonCompilerArguments.WARN -> "coroutinesWarn"
CommonCompilerArguments.ERROR -> "coroutinesError"
else -> null
}
if (coroutineOption != null) {
Element("option").apply {
setAttribute("name", coroutineOption)
setAttribute("value", "true")
it.addContent(this)
}
}
}
}
fun KotlinFacetSettings.serializeFacetSettings(element: Element) {
val versionToWrite = if (version == 2) version else KotlinFacetSettings.CURRENT_VERSION
element.setAttribute("version", versionToWrite.toString())
if (versionToWrite == 2) {
writeV2Config(element)
} else {
writeLatestConfig(element)
}
writeLatestConfig(element)
}
private fun TargetPlatform.serializeComponentPlatforms(): String {