1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Refactor.

This commit is contained in:
Cedric Beust 2016-02-20 13:04:50 -08:00
parent 75fbc466d5
commit 4aba3d6f1b

View file

@ -8,15 +8,17 @@ enum class SourceSet {
MAIN,
TEST;
private fun unknown(sourceSet: SourceSet) = throw KobaltException("Unknown source set: $this")
fun correctSourceSet(project: Project) =
if (this == SourceSet.MAIN) project.sourceDirectories
else if (this == SourceSet.TEST) project.sourceDirectoriesTest
else throw KobaltException("Unknown source set: $this")
else unknown(this)
fun correctOutputDir(project: Project) =
if (this == SourceSet.MAIN) KFiles.CLASSES_DIR
else if (this == SourceSet.TEST) KFiles.TEST_CLASSES_DIR
else throw IllegalArgumentException("Unknown source set: $this")
else unknown(this)
companion object {
fun of(isTest: Boolean) = if (isTest) TEST else MAIN