Mindustry/server/build.gradle

90 lines
2.0 KiB
Groovy
Raw Normal View History

apply plugin: "java"
sourceCompatibility = 1.8
2019-04-08 20:03:18 +07:00
sourceSets.main.java.srcDirs = ["src/"]
project.ext.mainClassName = "io.anuke.mindustry.server.ServerLauncher"
2018-10-06 22:56:39 +07:00
project.ext.assetsDir = new File("../core/assets")
ext.getServerFolder = {
return "../deploy/${appName}-server-${getVersionString()}"
}
2019-04-08 20:03:18 +07:00
task run(dependsOn: classes, type: JavaExec){
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
2019-04-08 20:03:18 +07:00
if(project.hasProperty("appArgs")){
args Eval.me(appArgs)
}
}
2019-04-08 20:03:18 +07:00
task debug(dependsOn: classes, type: JavaExec){
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
2019-04-08 20:03:18 +07:00
task dist(type: Jar){
2018-02-02 10:16:00 +07:00
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
2019-04-08 20:03:18 +07:00
from{ configurations.compile.collect{ zipTree(it) } }
2018-10-06 22:56:39 +07:00
from files(project.assetsDir)
exclude("sprites/**")
2019-08-06 20:17:26 +07:00
exclude("music/**")
exclude("sounds/**")
exclude("fonts/**")
2019-08-16 23:05:00 +07:00
exclude("zones/**")
exclude("com/badlogic/gdx/**")
2019-08-16 23:05:00 +07:00
exclude("icons/**")
exclude("bundles/**")
2018-05-04 00:04:30 +07:00
writeVersion()
2019-04-08 20:03:18 +07:00
manifest{
attributes 'Main-Class': project.mainClassName
}
}
task dzip(type: Zip){
from getServerFolder()
2019-08-16 22:00:15 +07:00
archiveName "${generateDeployName('server')}.zip"
destinationDir(file("../deploy/"))
finalizedBy 'cleanup'
}
task cleanup{
doLast{
delete{
delete getServerFolder()
}
}
}
task deploy{
dependsOn "dist"
finalizedBy 'dzip'
doLast{
copy{
from "build/libs/server-release.jar"
into getServerFolder()
rename("server-release.jar", "server.jar")
}
copy{
from "server_template"
into getServerFolder()
}
}
}
dist.dependsOn classes