mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Ignore nonexistent directories.
This commit is contained in:
parent
1cabff5215
commit
faf2eeb1d8
1 changed files with 14 additions and 21 deletions
|
@ -4,6 +4,7 @@ import com.beust.kobalt.TestConfig
|
||||||
import com.beust.kobalt.api.annotation.Directive
|
import com.beust.kobalt.api.annotation.Directive
|
||||||
import com.beust.kobalt.maven.dependency.MavenDependency
|
import com.beust.kobalt.maven.dependency.MavenDependency
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
import com.beust.kobalt.misc.log
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -28,13 +29,17 @@ open class Project(
|
||||||
Kobalt.context?.let {
|
Kobalt.context?.let {
|
||||||
project.sourceDirectories.forEach { source ->
|
project.sourceDirectories.forEach { source ->
|
||||||
val sourceDir = File(KFiles.joinDir(project.directory, source))
|
val sourceDir = File(KFiles.joinDir(project.directory, source))
|
||||||
KFiles.findRecursively(sourceDir, { file ->
|
if (sourceDir.exists()) {
|
||||||
val ind = file.lastIndexOf(".")
|
KFiles.findRecursively(sourceDir, { file ->
|
||||||
if (ind >= 0) {
|
val ind = file.lastIndexOf(".")
|
||||||
sf.add(file.substring(ind + 1))
|
if (ind >= 0) {
|
||||||
}
|
sf.add(file.substring(ind + 1))
|
||||||
false
|
}
|
||||||
})
|
false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
log(2, "Skipping nonexistent directory $sourceDir")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sf
|
sf
|
||||||
|
@ -48,9 +53,6 @@ open class Project(
|
||||||
* @return true if any of the projects we depend on is dirty.
|
* @return true if any of the projects we depend on is dirty.
|
||||||
*/
|
*/
|
||||||
fun dependsOnDirtyProjects(project: Project) = project.projectExtra.dependsOn.any { it.projectExtra.isDirty }
|
fun dependsOnDirtyProjects(project: Project) = project.projectExtra.dependsOn.any { it.projectExtra.isDirty }
|
||||||
|
|
||||||
init {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,23 +91,14 @@ open class Project(
|
||||||
|
|
||||||
private fun existing(dirs: Set<String>) = dirs.filter { File(directory, it).exists() }.toHashSet()
|
private fun existing(dirs: Set<String>) = dirs.filter { File(directory, it).exists() }.toHashSet()
|
||||||
|
|
||||||
var sourceDirectories = hashSetOf<String>()
|
var sourceDirectories = hashSetOf<String>().apply { addAll(DEFAULT_SOURCE_DIRECTORIES)}
|
||||||
get() = existing(if (field.isEmpty()) DEFAULT_SOURCE_DIRECTORIES else field)
|
|
||||||
set(value) { field = value }
|
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
fun sourceDirectoriesTest(init: Sources.() -> Unit) : Sources {
|
fun sourceDirectoriesTest(init: Sources.() -> Unit) : Sources {
|
||||||
return Sources(this, sourceDirectoriesTest).apply { init() }
|
return Sources(this, sourceDirectoriesTest).apply { init() }
|
||||||
}
|
}
|
||||||
|
|
||||||
var sourceDirectoriesTest = hashSetOf<String>()
|
var sourceDirectoriesTest = hashSetOf<String>().apply { addAll(DEFAULT_SOURCE_DIRECTORIES_TEST)}
|
||||||
get() = existing(if (field.isEmpty()) DEFAULT_SOURCE_DIRECTORIES_TEST else field)
|
|
||||||
set(value) { field = value }
|
|
||||||
|
|
||||||
init {
|
|
||||||
sourceDirectories = hashSetOf()
|
|
||||||
sourceDirectoriesTest = hashSetOf()
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Dependencies
|
// Dependencies
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue