mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Refactor.
This commit is contained in:
parent
75fbc466d5
commit
4aba3d6f1b
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue