Added deploy task.
This commit is contained in:
parent
7076c928a1
commit
940f10bf60
1 changed files with 59 additions and 29 deletions
|
@ -1,17 +1,23 @@
|
|||
import com.beust.kobalt.*
|
||||
import com.beust.kobalt.plugin.apt.*
|
||||
import com.beust.kobalt.plugin.packaging.*
|
||||
import com.beust.kobalt.plugin.application.*
|
||||
import com.beust.kobalt.plugin.java.*
|
||||
import com.beust.kobalt.api.Project
|
||||
import com.beust.kobalt.api.annotation.Task
|
||||
import com.beust.kobalt.misc.KobaltLogger
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.beust.kobalt.plugin.application.application
|
||||
import com.beust.kobalt.plugin.apt.apt
|
||||
import com.beust.kobalt.plugin.packaging.assemble
|
||||
import com.beust.kobalt.plugin.packaging.install
|
||||
import com.beust.kobalt.plugin.publish.autoGitTag
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.util.*
|
||||
|
||||
val bs = buildScript {
|
||||
repos()
|
||||
repos(file("K:/maven/repository"))
|
||||
}
|
||||
|
||||
val mainClassName = "net.thauvin.erik.mobibot.Mobibot"
|
||||
val deploy = "deploy"
|
||||
|
||||
fun StringBuilder.prepend(s: String): StringBuilder {
|
||||
if (this.isNotEmpty()) {
|
||||
|
@ -41,7 +47,8 @@ val p = project {
|
|||
|
||||
version = versionFor()
|
||||
|
||||
val processorJar = "net.thauvin.erik:semver:"
|
||||
val processorJar = "net.thauvin.erik:semver:0.9.7"
|
||||
val lib = "lib"
|
||||
|
||||
dependencies {
|
||||
compile("log4j:log4j:jar:1.2.17")
|
||||
|
@ -62,7 +69,6 @@ val p = project {
|
|||
compile("org.json:json:20160810")
|
||||
compile("org.ostermiller:utils:1.07.00")
|
||||
|
||||
compile("net.sourceforge.jweather:jweather:jar:0.3.0")
|
||||
compile("net.objecthunter:exp4j:0.4.8")
|
||||
|
||||
compile("org.twitter4j:twitter4j-core:4.0.6")
|
||||
|
@ -71,19 +77,29 @@ val p = project {
|
|||
compile(file("lib/owm-japis-2.5.0.5.jar"))
|
||||
|
||||
apt(processorJar)
|
||||
compile(processorJar)
|
||||
compileOnly(processorJar)
|
||||
}
|
||||
|
||||
apt {
|
||||
outputDir = "/src/generated/java/"
|
||||
outputDir = "../src/generated/java/"
|
||||
}
|
||||
|
||||
autoGitTag {
|
||||
enabled = true
|
||||
message = "Version $version"
|
||||
annotated = true
|
||||
}
|
||||
|
||||
assemble {
|
||||
jar {
|
||||
name = "${project.name}.jar"
|
||||
fatJar = true
|
||||
manifest {
|
||||
attributes("Main-Class", mainClassName)
|
||||
attributes("Class-Path",
|
||||
collect(compileDependencies)
|
||||
.filter { !it.file.name.startsWith("junit") }
|
||||
.map { it.file.name }
|
||||
.joinToString(" ./$lib/", prefix = ". ./$lib/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +110,20 @@ val p = project {
|
|||
}
|
||||
|
||||
install {
|
||||
libDir = "deploy"
|
||||
target = deploy
|
||||
include(from("kobaltBuild/libs"), to(target), glob("**/*"))
|
||||
include(from("properties"), to(target), glob("**/*.properties"))
|
||||
collect(compileDependencies)
|
||||
.filter { !it.file.name.startsWith("junit") }
|
||||
.forEach {
|
||||
copy(from(it.file.absolutePath), to("$target/$lib"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Task(name = "deploy", dependsOn = arrayOf("assemble", "install"), description = "Deploy application")
|
||||
fun deploy(project: Project): TaskResult {
|
||||
File("$deploy/logs").mkdir()
|
||||
KobaltLogger.log(1, " Deployed to " + File(deploy).absolutePath)
|
||||
return TaskResult()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue