1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27: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

@ -21,6 +21,8 @@ class Archives {
private val DEFAULT_STREAM_FACTORY = { os : OutputStream -> ZipOutputStream(os) }
fun defaultArchiveName(project: Project) = project.name + "-" + project.version
fun generateArchive(project: Project,
context: KobaltContext,
archiveName: String?,

View file

@ -1,11 +1,14 @@
package com.beust.kobalt.archive
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.annotation.Directive
/**
* A jar is exactly like a zip with the addition of a manifest and an optional fatJar boolean.
*/
open class Jar(override var name: String? = null, var fatJar: Boolean = false) : Zip(name), AttributeHolder {
open class Jar(override val project: Project,
override var name : String = Archives.defaultArchiveName(project) + ".jar",
var fatJar: Boolean = false) : Zip(project, name), AttributeHolder {
@Directive
fun manifest(init: Manifest.(p: Manifest) -> Unit) : Manifest {
val m = Manifest(this)

View file

@ -1,8 +1,10 @@
package com.beust.kobalt.archive
import com.beust.kobalt.api.Project
import com.beust.kobalt.glob
class War(override var name: String? = null) : Jar(name), AttributeHolder {
class War(override val project: Project, override var name: String = Archives.defaultArchiveName(project) + ".war")
: Jar(project, name), AttributeHolder {
init {
include(from("src/main/webapp"),to(""), glob("**"))
include(from("kobaltBuild/classes"), to("WEB-INF/classes"), glob("**"))

View file

@ -2,12 +2,13 @@ package com.beust.kobalt.archive
import com.beust.kobalt.Glob
import com.beust.kobalt.IFileSpec
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.misc.From
import com.beust.kobalt.misc.IncludedFile
import com.beust.kobalt.misc.To
open class Zip(open var name: String? = null) {
open class Zip(open val project: Project, open var name: String = Archives.defaultArchiveName(project) + ".zip") {
val excludes = arrayListOf<Glob>()
@Directive