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

Better jar default naming.

This commit is contained in:
Cedric Beust 2016-06-14 23:43:20 -08:00
parent 960472be68
commit 182345d8e2
6 changed files with 16 additions and 15 deletions

View file

@ -5,7 +5,6 @@ import com.beust.kobalt.api.*
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.api.annotation.Task
import com.beust.kobalt.archive.Archives
import com.beust.kobalt.archive.Jar
import com.beust.kobalt.internal.ActorUtils
import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.misc.KFiles
@ -66,14 +65,8 @@ class ApplicationPlugin @Inject constructor(val configActor: ConfigActor<Applica
}
private fun isFatJar(packages: List<PackageConfig>, jarName: String): Boolean {
packages.forEach { pc ->
(pc.jars as List<Jar>).forEach { jar ->
if ((jar.name == null || jar.name == jarName) && jar.fatJar) {
return true
}
}
}
return false
val foundJar = packages.flatMap { it.jars }.filter { jarName.endsWith(it.name) }
return foundJar.size == 1 && foundJar[0].fatJar
}
// IRunContributor

View file

@ -183,19 +183,19 @@ class PackageConfig(val project: Project) : AttributeHolder {
}
@Directive
fun jar(init: Jar.(p: Jar) -> Unit) = Jar().apply {
fun jar(init: Jar.(p: Jar) -> Unit) = Jar(project).apply {
init(this)
jars.add(this)
}
@Directive
fun zip(init: Zip.(p: Zip) -> Unit) = Zip().apply {
fun zip(init: Zip.(p: Zip) -> Unit) = Zip(project).apply {
init(this)
zips.add(this)
}
@Directive
fun war(init: War.(p: War) -> Unit) = War().apply {
fun war(init: War.(p: War) -> Unit) = War(project).apply {
init(this)
wars.add(this)
}