Pill: Support Kotlin JUnit configurations

This commit is contained in:
Yan Zhulanow
2019-12-26 17:30:51 +09:00
parent 66cd78fbc0
commit ea957872eb
+12 -1
View File
@@ -231,6 +231,7 @@ class JpsCompatiblePlugin : Plugin<Project> {
val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir) val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir)
val runManagerComponent = rootElement.getOrCreateChild("component", "name" to "RunManager") val runManagerComponent = rootElement.getOrCreateChild("component", "name" to "RunManager")
val junitConfiguration = runManagerComponent.getOrCreateChild( val junitConfiguration = runManagerComponent.getOrCreateChild(
"configuration", "configuration",
"default" to "true", "default" to "true",
@@ -238,7 +239,14 @@ class JpsCompatiblePlugin : Plugin<Project> {
"factoryName" to "JUnit" "factoryName" to "JUnit"
) )
junitConfiguration.apply { val kotlinJunitConfiguration = runManagerComponent.getOrCreateChild(
"configuration",
"default" to "true",
"type" to "KotlinJUnit",
"factoryName" to "Kotlin JUnit"
)
fun Element.applyJUnitTemplate() {
getOrCreateChild("option", "name" to "WORKING_DIRECTORY").setAttribute("value", "file://\$PROJECT_DIR\$") getOrCreateChild("option", "name" to "WORKING_DIRECTORY").setAttribute("value", "file://\$PROJECT_DIR\$")
getOrCreateChild("option", "name" to "VM_PARAMETERS").also { vmParams -> getOrCreateChild("option", "name" to "VM_PARAMETERS").also { vmParams ->
var options = vmParams.getAttributeValue("value", "") var options = vmParams.getAttributeValue("value", "")
@@ -275,6 +283,9 @@ class JpsCompatiblePlugin : Plugin<Project> {
} }
} }
junitConfiguration.applyJUnitTemplate()
kotlinJunitConfiguration.applyJUnitTemplate()
val output = XMLOutputter().also { val output = XMLOutputter().also {
it.format = Format.getPrettyFormat().apply { it.format = Format.getPrettyFormat().apply {
setEscapeStrategy { Verifier.isHighSurrogate(it) || it == '"' } setEscapeStrategy { Verifier.isHighSurrogate(it) || it == '"' }