mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
move TestConfig into separate file
This commit is contained in:
parent
07b68e72c5
commit
598d8b26c5
3 changed files with 41 additions and 37 deletions
|
@ -0,0 +1,40 @@
|
||||||
|
package com.beust.kobalt
|
||||||
|
|
||||||
|
import com.beust.kobalt.api.Project
|
||||||
|
import com.beust.kobalt.api.annotation.Directive
|
||||||
|
|
||||||
|
class TestConfig(val project: Project, val isDefault : Boolean = false) {
|
||||||
|
val testArgs = arrayListOf<String>()
|
||||||
|
val jvmArgs = arrayListOf<String>()
|
||||||
|
val testIncludes = arrayListOf("**/*Test.class")
|
||||||
|
val testExcludes = arrayListOf<String>()
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
var name: String = ""
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
fun args(vararg arg: String) {
|
||||||
|
testArgs.addAll(arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
fun jvmArgs(vararg arg: String) {
|
||||||
|
jvmArgs.addAll(arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
fun include(vararg arg: String) {
|
||||||
|
testIncludes.apply {
|
||||||
|
clear()
|
||||||
|
addAll(arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
fun exclude(vararg arg: String) {
|
||||||
|
testExcludes.apply {
|
||||||
|
clear()
|
||||||
|
addAll(arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,42 +3,6 @@ package com.beust.kobalt
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.api.annotation.Directive
|
import com.beust.kobalt.api.annotation.Directive
|
||||||
|
|
||||||
class TestConfig(val project: Project, val isDefault : Boolean = false) {
|
|
||||||
val testArgs = arrayListOf<String>()
|
|
||||||
val jvmArgs = arrayListOf<String>()
|
|
||||||
val testIncludes = arrayListOf("**/*Test.class")
|
|
||||||
val testExcludes = arrayListOf<String>()
|
|
||||||
|
|
||||||
@Directive
|
|
||||||
var name: String = ""
|
|
||||||
|
|
||||||
@Directive
|
|
||||||
fun args(vararg arg: String) {
|
|
||||||
testArgs.addAll(arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Directive
|
|
||||||
fun jvmArgs(vararg arg: String) {
|
|
||||||
jvmArgs.addAll(arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Directive
|
|
||||||
fun include(vararg arg: String) {
|
|
||||||
testIncludes.apply {
|
|
||||||
clear()
|
|
||||||
addAll(arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Directive
|
|
||||||
fun exclude(vararg arg: String) {
|
|
||||||
testExcludes.apply {
|
|
||||||
clear()
|
|
||||||
addAll(arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
fun Project.test(init: TestConfig.() -> Unit): TestConfig = let { project ->
|
fun Project.test(init: TestConfig.() -> Unit): TestConfig = let { project ->
|
||||||
with(testConfigs) {
|
with(testConfigs) {
|
||||||
|
|
|
@ -142,7 +142,7 @@ abstract class GenericTestRunner: ITestRunnerContributor {
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
fun calculateAllJvmArgs(project: Project, context: KobaltContext,
|
fun calculateAllJvmArgs(project: Project, context: KobaltContext,
|
||||||
testConfig: TestConfig, classpath: List<IClasspathDependency>, pluginInfo: IPluginInfo) : List<String> {
|
testConfig: TestConfig, classpath: List<IClasspathDependency>, pluginInfo: IPluginInfo) : List<String> {
|
||||||
// Default JVM args
|
// Default JVM args
|
||||||
val jvmFlags = arrayListOf<String>().apply {
|
val jvmFlags = arrayListOf<String>().apply {
|
||||||
addAll(testConfig.jvmArgs)
|
addAll(testConfig.jvmArgs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue