1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00
This commit is contained in:
Cedric Beust 2015-12-29 08:30:30 +04:00
parent 701a5d9356
commit 15db122504
7 changed files with 20 additions and 20 deletions

View file

@ -2,7 +2,7 @@ package com.beust.kobalt.plugin.packaging
import com.beust.kobalt.*
import com.beust.kobalt.IFileSpec.FileSpec
import com.beust.kobalt.IFileSpec.Glob
import com.beust.kobalt.IFileSpec.GlobSpec
import com.beust.kobalt.api.*
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.api.annotation.ExportedProjectProperty
@ -43,7 +43,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
const val TASK_INSTALL: String = "install"
fun findIncludedFiles(directory: String, files: List<IncludedFile>, excludes: List<IFileSpec.Glob>)
fun findIncludedFiles(directory: String, files: List<IncludedFile>, excludes: List<IFileSpec.GlobSpec>)
: List<IncludedFile> {
val result = arrayListOf<IncludedFile>()
files.forEach { includedFile ->
@ -313,7 +313,7 @@ class PackageConfig(val project: Project) : AttributeHolder {
open class Zip(open var name: String? = null) {
// internal val includes = arrayListOf<IFileSpec>()
internal val excludes = arrayListOf<Glob>()
internal val excludes = arrayListOf<GlobSpec>()
@Directive
public fun from(s: String) = From(s)
@ -323,11 +323,11 @@ open class Zip(open var name: String? = null) {
@Directive
public fun exclude(vararg files: String) {
files.forEach { excludes.add(Glob(it)) }
files.forEach { excludes.add(GlobSpec(it)) }
}
@Directive
public fun exclude(vararg specs: Glob) {
public fun exclude(vararg specs: GlobSpec) {
specs.forEach { excludes.add(it) }
}
@ -342,7 +342,7 @@ open class Zip(open var name: String? = null) {
}
@Directive
public fun include(from: From, to: To, vararg specs: Glob) {
public fun include(from: From, to: To, vararg specs: GlobSpec) {
includedFiles.add(IncludedFile(from, to, listOf(*specs)))
}

View file

@ -24,8 +24,8 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager)
// src/main/web app and classes
//
val result = arrayListOf(
IncludedFile(From("src/main/webapp"), To(""), listOf(IFileSpec.Glob("**"))),
IncludedFile(From("kobaltBuild/classes"), To("WEB-INF/classes"), listOf(IFileSpec.Glob("**")))
IncludedFile(From("src/main/webapp"), To(""), listOf(IFileSpec.GlobSpec("**"))),
IncludedFile(From("kobaltBuild/classes"), To("WEB-INF/classes"), listOf(IFileSpec.GlobSpec("**")))
)
//
@ -55,7 +55,7 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager)
KFiles.copy(Paths.get(it.absolutePath), Paths.get(fullDir, it.name))
}
result.add(IncludedFile(From(fullDir), To(WEB_INF), listOf(IFileSpec.Glob("**"))))
result.add(IncludedFile(From(fullDir), To(WEB_INF), listOf(IFileSpec.GlobSpec("**"))))
return result
}

View file

@ -9,7 +9,7 @@ import java.io.File
class IncludedFileTest {
fun simple() {
val from = "src/main/kotlin/"
val inf = IncludedFile(From(from), To(""), listOf(IFileSpec.Glob("**.kt")))
val inf = IncludedFile(From(from), To(""), listOf(IFileSpec.GlobSpec("**.kt")))
inf.allFromFiles().map { File(from, it.path) }.forEach {
Assert.assertTrue(it.exists(), "Should exist: $it")
}