Mindustry/server/build.gradle

93 lines
2.2 KiB
Groovy
Raw Permalink Normal View History

2019-04-08 20:03:18 +07:00
sourceSets.main.java.srcDirs = ["src/"]
2019-12-25 13:39:38 +07:00
project.ext.mainClassName = "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){
2021-12-07 10:13:06 +07:00
mainClass = 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)
}
if(project.hasProperty("jvmArgs")){
jvmArgs((List<String>)Eval.me(project.getProperties()["jvmArgs"]))
}
}
2019-04-08 20:03:18 +07:00
task debug(dependsOn: classes, type: JavaExec){
2021-12-07 10:13:06 +07:00
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
2020-05-22 03:50:49 +07:00
task dist(type: Jar, dependsOn: configurations.runtimeClasspath){
2018-02-02 10:16:00 +07:00
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
2020-05-22 01:57:15 +07:00
from {configurations.runtimeClasspath.collect{ it.isDirectory() ? it : 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/**")
exclude("bundles/**")
2021-02-21 21:22:02 +07:00
exclude("cubemaps/**")
exclude("cursors/**")
exclude("shaders/**")
exclude("icons/icon.icns")
exclude("icons/icon.ico")
exclude("icons/icon_64.png")
2018-05-04 00:04:30 +07:00
duplicatesStrategy = 'exclude'
2019-04-08 20:03:18 +07:00
manifest{
attributes 'Main-Class': project.mainClassName
}
}
task dzip(type: Zip){
from getServerFolder()
2019-11-16 07:48:26 +07:00
archiveFileName = "${generateDeployName('server')}.zip"
destinationDirectory = 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