mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Break if no test sources are found and test{} was specified.
Fixes https://github.com/cbeust/kobalt/issues/253
This commit is contained in:
parent
413606ec33
commit
f5560b2907
3 changed files with 5 additions and 3 deletions
|
@ -3,7 +3,7 @@ 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) {
|
class TestConfig(val project: Project, val isDefault : Boolean = false) {
|
||||||
val testArgs = arrayListOf<String>()
|
val testArgs = arrayListOf<String>()
|
||||||
val jvmArgs = arrayListOf<String>()
|
val jvmArgs = arrayListOf<String>()
|
||||||
val testIncludes = arrayListOf("**/*.class")
|
val testIncludes = arrayListOf("**/*.class")
|
||||||
|
|
|
@ -71,7 +71,7 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
// users don't have to specify a test{}
|
// users don't have to specify a test{}
|
||||||
//
|
//
|
||||||
if (project.testConfigs.isEmpty()) {
|
if (project.testConfigs.isEmpty()) {
|
||||||
project.testConfigs.add(TestConfig(project))
|
project.testConfigs.add(TestConfig(project, isDefault = true))
|
||||||
}
|
}
|
||||||
project.testConfigs.forEach { config ->
|
project.testConfigs.forEach { config ->
|
||||||
val taskName = if (config.name.isEmpty()) TASK_TEST else TASK_TEST + config.name
|
val taskName = if (config.name.isEmpty()) TASK_TEST else TASK_TEST + config.name
|
||||||
|
|
|
@ -42,7 +42,9 @@ class TestNgRunner : GenericTestRunner() {
|
||||||
add("-testclass")
|
add("-testclass")
|
||||||
add(testClasses.joinToString(","))
|
add(testClasses.joinToString(","))
|
||||||
} else {
|
} else {
|
||||||
warn("Couldn't find any test classes for ${project.name}")
|
if (! testConfig.isDefault) warn("Couldn't find any test classes for ${project.name}")
|
||||||
|
// else do nothing: since the user didn't specify an explicit test{} directive, not finding
|
||||||
|
// any test sources is not a problem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue