1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -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:
Cedric Beust 2016-07-05 23:18:38 -08:00
parent 413606ec33
commit f5560b2907
3 changed files with 5 additions and 3 deletions

View file

@ -3,7 +3,7 @@ package com.beust.kobalt
import com.beust.kobalt.api.Project
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 jvmArgs = arrayListOf<String>()
val testIncludes = arrayListOf("**/*.class")

View file

@ -71,7 +71,7 @@ open class JvmCompilerPlugin @Inject constructor(
// users don't have to specify a test{}
//
if (project.testConfigs.isEmpty()) {
project.testConfigs.add(TestConfig(project))
project.testConfigs.add(TestConfig(project, isDefault = true))
}
project.testConfigs.forEach { config ->
val taskName = if (config.name.isEmpty()) TASK_TEST else TASK_TEST + config.name

View file

@ -42,7 +42,9 @@ class TestNgRunner : GenericTestRunner() {
add("-testclass")
add(testClasses.joinToString(","))
} 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 {