Pill: Add "Generate All Tests" run configuration

This commit is contained in:
Yan Zhulanow
2018-02-15 23:40:11 +03:00
parent 55164660a8
commit e7a2743dcf
7 changed files with 261 additions and 18 deletions
+4 -3
View File
@@ -99,7 +99,8 @@ private val CONFIGURATION_MAPPING = mapOf(
private val TEST_CONFIGURATION_MAPPING = mapOf(
listOf("runtime", "testRuntime") to Scope.RUNTIME,
listOf("compile", "testCompile") to Scope.COMPILE,
listOf("compileOnly", "testCompileOnly") to Scope.PROVIDED
listOf("compileOnly", "testCompileOnly") to Scope.PROVIDED,
listOf("jpsTest") to Scope.TEST
)
private val SOURCE_SET_MAPPING = mapOf(
@@ -273,9 +274,9 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
}
}
if (dependency.configuration == "runtimeElements") {
if (dependency.configuration == "runtimeElements" && scope != Scope.TEST) {
mainRoots += POrderRoot(PDependency.Module(dependency.moduleName + ".src"), scope)
} else if (dependency.configuration == "tests-jar") {
} else if (dependency.configuration == "tests-jar" || dependency.configuration == "jpsTest") {
mainRoots += POrderRoot(
PDependency.Module(dependency.moduleName + ".test"),
scope,
+4 -1
View File
@@ -14,7 +14,10 @@ import java.io.FileOutputStream
import javax.xml.transform.stream.StreamResult
class JpsCompatiblePlugin : Plugin<Project> {
override fun apply(project: Project) {}
override fun apply(project: Project) {
// 'jpsTest' does not require the 'tests-jar' artifact
project.configurations.create("jpsTest")
}
}
class JpsCompatibleRootPlugin : Plugin<Project> {
@@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] Generate All Tests" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="org.jetbrains.kotlin.pill.generateAllTests.Main" />
<module name="generate-all-tests.test" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<method />
</configuration>
</component>