KT-57927: Fix deserialization of K2JVMCompilerArguments in FP/MT tests
Due to changes in 9dcd40d7b7
classpath and pluginClasspath arguments become Arrays
Now we need to update arguments representation to properly deserialize
it
^KT-57927
This commit is contained in:
committed by
Space Team
parent
af05646fe3
commit
98aca55a2a
+34
@@ -149,8 +149,42 @@ abstract class AbstractModularizedTest : KtUsefulTestCase() {
|
|||||||
return modules.map { node -> loadModule(node).also { it.arguments = arguments } }
|
return modules.map { node -> loadModule(node).also { it.arguments = arguments } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove once support for snapshot 2022 is ended
|
||||||
|
private fun updateCompilerArgumentsXml(element: Element) {
|
||||||
|
fun convertOptionToList(optionElement: Element) {
|
||||||
|
if (optionElement.getAttribute("value") == null) return
|
||||||
|
val paths = optionElement.getAttributeValue("value").split(":")
|
||||||
|
|
||||||
|
optionElement.removeAttribute("value")
|
||||||
|
|
||||||
|
val listElement = Element("list")
|
||||||
|
paths.forEach { path ->
|
||||||
|
val pathElement = Element("option")
|
||||||
|
pathElement.setAttribute("value", path)
|
||||||
|
listElement.addContent(pathElement)
|
||||||
|
}
|
||||||
|
|
||||||
|
optionElement.addContent(listElement)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun findOptionElements(parentElement: Element, optionName: String): List<Element> {
|
||||||
|
return parentElement.getChildren("option")
|
||||||
|
.filter { it.getAttributeValue("name") == optionName }
|
||||||
|
}
|
||||||
|
|
||||||
|
// See KT-57927
|
||||||
|
findOptionElements(element, "classpath").forEach {
|
||||||
|
convertOptionToList(it)
|
||||||
|
}
|
||||||
|
findOptionElements(element, "pluginClasspath").forEach {
|
||||||
|
convertOptionToList(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun loadCompilerArguments(argumentsRoot: Element): CommonCompilerArguments? {
|
private fun loadCompilerArguments(argumentsRoot: Element): CommonCompilerArguments? {
|
||||||
val element = argumentsRoot.children.singleOrNull() ?: return null
|
val element = argumentsRoot.children.singleOrNull() ?: return null
|
||||||
|
updateCompilerArgumentsXml(element)
|
||||||
return when (element.name) {
|
return when (element.name) {
|
||||||
"K2JVMCompilerArguments" -> K2JVMCompilerArguments().also { XmlSerializer.deserializeInto(it, element) }
|
"K2JVMCompilerArguments" -> K2JVMCompilerArguments().also { XmlSerializer.deserializeInto(it, element) }
|
||||||
else -> null
|
else -> null
|
||||||
|
|||||||
Reference in New Issue
Block a user