mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Refactor.
This commit is contained in:
parent
4aba3d6f1b
commit
9f3f09ea6a
1 changed files with 11 additions and 11 deletions
|
@ -8,21 +8,21 @@ enum class SourceSet {
|
||||||
MAIN,
|
MAIN,
|
||||||
TEST;
|
TEST;
|
||||||
|
|
||||||
private fun unknown(sourceSet: SourceSet) = throw KobaltException("Unknown source set: $this")
|
fun correctSourceSet(project: Project) = when(this) {
|
||||||
|
SourceSet.MAIN -> project.sourceDirectories
|
||||||
|
SourceSet.TEST -> project.sourceDirectoriesTest
|
||||||
|
else -> unknown(this)
|
||||||
|
}
|
||||||
|
|
||||||
fun correctSourceSet(project: Project) =
|
fun correctOutputDir(project: Project) = when(this) {
|
||||||
if (this == SourceSet.MAIN) project.sourceDirectories
|
SourceSet.MAIN -> KFiles.CLASSES_DIR
|
||||||
else if (this == SourceSet.TEST) project.sourceDirectoriesTest
|
SourceSet.TEST -> KFiles.TEST_CLASSES_DIR
|
||||||
else unknown(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 unknown(this)
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun of(isTest: Boolean) = if (isTest) TEST else MAIN
|
fun of(isTest: Boolean) = if (isTest) TEST else MAIN
|
||||||
|
private fun unknown(sourceSet: SourceSet) = throw KobaltException("Unknown source set: $sourceSet")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue