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

Merge branch 'master' of github.com:cbeust/kobalt

Conflicts:
	kobalt/wrapper/kobalt-wrapper.properties
	src/main/resources/kobalt.properties
This commit is contained in:
Cedric Beust 2015-12-31 10:21:06 -08:00
commit 31d22e3c1c
10 changed files with 31 additions and 27 deletions

View file

@ -58,4 +58,4 @@ fun authRepos(vararg repos : HostConfig) {
fun authRepo(init: HostConfig.() -> Unit) = HostConfig().apply { init() }
@Directive
fun glob(g: String) : IFileSpec.Glob = IFileSpec.Glob(g)
fun glob(g: String) : IFileSpec.GlobSpec = IFileSpec.GlobSpec(g)

View file

@ -9,16 +9,16 @@ sealed class IFileSpec {
abstract fun toFiles(directory: String): List<File>
class FileSpec(val spec: String) : IFileSpec() {
override public fun toFiles(directory: String) = arrayListOf(File(spec))
override public fun toFiles(directory: String) = listOf(File(spec))
override public fun toString() = spec
}
class Glob(val spec: String) : IFileSpec() {
class GlobSpec(val spec: String) : IFileSpec() {
override public fun toFiles(directory: String): List<File> {
val result = arrayListOf<File>()
val matcher = FileSystems.getDefault().getPathMatcher("glob:${spec}")
val matcher = FileSystems.getDefault().getPathMatcher("glob:$spec")
Files.walkFileTree(Paths.get(directory), object : SimpleFileVisitor<Path>() {
override public fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
val rel = Paths.get(directory).relativize(path)

View file

@ -29,9 +29,9 @@ public class JarUtils {
}
private val DEFAULT_JAR_EXCLUDES = arrayListOf(
IFileSpec.Glob("META-INF/*.SF"),
IFileSpec.Glob("META-INF/*.DSA"),
IFileSpec.Glob("META-INF/*.RSA"))
IFileSpec.GlobSpec("META-INF/*.SF"),
IFileSpec.GlobSpec("META-INF/*.DSA"),
IFileSpec.GlobSpec("META-INF/*.RSA"))
public fun addSingleFile(directory: String, file: IncludedFile, outputStream: ZipOutputStream,
expandJarFiles: Boolean, onError: (Exception) -> Unit = DEFAULT_HANDLER) {
@ -57,7 +57,7 @@ public class JarUtils {
outputStream.closeEntry()
}
}
val includedFile = IncludedFile(From(source.path), To(""), listOf(IFileSpec.Glob("**")))
val includedFile = IncludedFile(From(source.path), To(""), listOf(IFileSpec.GlobSpec("**")))
addSingleFile(".", includedFile, outputStream, expandJarFiles)
} else {
if (expandJarFiles and source.name.endsWith(".jar")) {

View file

@ -277,9 +277,9 @@ class KFiles {
fun makeOutputTestDir(project: Project) : File = makeDir(project, KFiles.TEST_CLASSES_DIR)
fun isExcluded(file: File, excludes: List<IFileSpec.Glob>) = isExcluded(file.path, excludes)
fun isExcluded(file: File, excludes: List<IFileSpec.GlobSpec>) = isExcluded(file.path, excludes)
fun isExcluded(file: String, excludes: List<IFileSpec.Glob>) : Boolean {
fun isExcluded(file: String, excludes: List<IFileSpec.GlobSpec>) : Boolean {
if (excludes.isEmpty()) {
return false
} else {