mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
More refactoring.
This commit is contained in:
parent
9f3f09ea6a
commit
c34c69b1cc
2 changed files with 4 additions and 10 deletions
|
@ -115,7 +115,7 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
* Copy the resources from a source directory to the build one
|
* Copy the resources from a source directory to the build one
|
||||||
*/
|
*/
|
||||||
protected fun copyResources(project: Project, sourceSet: SourceSet) {
|
protected fun copyResources(project: Project, sourceSet: SourceSet) {
|
||||||
var outputDir = sourceSet.correctOutputDir(project)
|
var outputDir = sourceSet.outputDir
|
||||||
|
|
||||||
val variantSourceDirs = context.variant.resourceDirectories(project, sourceSet)
|
val variantSourceDirs = context.variant.resourceDirectories(project, sourceSet)
|
||||||
if (variantSourceDirs.size > 0) {
|
if (variantSourceDirs.size > 0) {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import com.beust.kobalt.KobaltException
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
|
||||||
enum class SourceSet {
|
enum class SourceSet(val outputDir: String) {
|
||||||
MAIN,
|
MAIN(KFiles.CLASSES_DIR),
|
||||||
TEST;
|
TEST(KFiles.TEST_CLASSES_DIR);
|
||||||
|
|
||||||
fun correctSourceSet(project: Project) = when(this) {
|
fun correctSourceSet(project: Project) = when(this) {
|
||||||
SourceSet.MAIN -> project.sourceDirectories
|
SourceSet.MAIN -> project.sourceDirectories
|
||||||
|
@ -14,12 +14,6 @@ enum class SourceSet {
|
||||||
else -> unknown(this)
|
else -> unknown(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun correctOutputDir(project: Project) = when(this) {
|
|
||||||
SourceSet.MAIN -> KFiles.CLASSES_DIR
|
|
||||||
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")
|
private fun unknown(sourceSet: SourceSet) = throw KobaltException("Unknown source set: $sourceSet")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue