From ea957872ebb1cfe78076c30cafdcd4e4a714e1e1 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Thu, 26 Dec 2019 17:30:51 +0900 Subject: [PATCH] Pill: Support Kotlin JUnit configurations --- buildSrc/src/main/kotlin/pill/plugin.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/pill/plugin.kt b/buildSrc/src/main/kotlin/pill/plugin.kt index 7d677f596de..52f2f6c7c52 100644 --- a/buildSrc/src/main/kotlin/pill/plugin.kt +++ b/buildSrc/src/main/kotlin/pill/plugin.kt @@ -231,6 +231,7 @@ class JpsCompatiblePlugin : Plugin { val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir) val runManagerComponent = rootElement.getOrCreateChild("component", "name" to "RunManager") + val junitConfiguration = runManagerComponent.getOrCreateChild( "configuration", "default" to "true", @@ -238,7 +239,14 @@ class JpsCompatiblePlugin : Plugin { "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 "VM_PARAMETERS").also { vmParams -> var options = vmParams.getAttributeValue("value", "") @@ -275,6 +283,9 @@ class JpsCompatiblePlugin : Plugin { } } + junitConfiguration.applyJUnitTemplate() + kotlinJunitConfiguration.applyJUnitTemplate() + val output = XMLOutputter().also { it.format = Format.getPrettyFormat().apply { setEscapeStrategy { Verifier.isHighSurrogate(it) || it == '"' }