2019-04-08 20:03:18 +07:00
|
|
|
sourceSets.main.java.srcDirs = ["src/"]
|
2018-01-28 11:42:42 +07:00
|
|
|
|
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")
|
2018-01-28 11:42:42 +07:00
|
|
|
|
2019-03-25 03:29:25 +07:00
|
|
|
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
|
2018-01-28 11:42:42 +07:00
|
|
|
classpath = sourceSets.main.runtimeClasspath
|
|
|
|
standardInput = System.in
|
|
|
|
workingDir = project.assetsDir
|
|
|
|
ignoreExitValue = true
|
2019-04-08 20:03:18 +07:00
|
|
|
if(project.hasProperty("appArgs")){
|
2018-01-28 11:42:42 +07:00
|
|
|
args Eval.me(appArgs)
|
|
|
|
}
|
2019-12-05 08:05:01 +07:00
|
|
|
if(project.hasProperty("jvmArgs")){
|
|
|
|
jvmArgs((List<String>)Eval.me(project.getProperties()["jvmArgs"]))
|
|
|
|
}
|
2018-01-28 11:42:42 +07:00
|
|
|
}
|
|
|
|
|
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
|
2018-01-28 11:42:42 +07:00
|
|
|
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)
|
2018-01-28 11:42:42 +07:00
|
|
|
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)
|
2019-03-10 07:12:54 +07:00
|
|
|
exclude("sprites/**")
|
2019-08-06 20:17:26 +07:00
|
|
|
exclude("music/**")
|
|
|
|
exclude("sounds/**")
|
2019-03-10 07:12:54 +07:00
|
|
|
exclude("fonts/**")
|
|
|
|
exclude("bundles/**")
|
2021-02-21 21:22:02 +07:00
|
|
|
exclude("cubemaps/**")
|
|
|
|
exclude("cursors/**")
|
|
|
|
exclude("shaders/**")
|
2023-05-30 00:09:56 +07:00
|
|
|
exclude("icons/icon.icns")
|
|
|
|
exclude("icons/icon.ico")
|
|
|
|
exclude("icons/icon_64.png")
|
2018-05-04 00:04:30 +07:00
|
|
|
|
2024-09-03 01:16:39 +07:00
|
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
|
2019-04-08 20:03:18 +07:00
|
|
|
manifest{
|
2018-01-28 11:42:42 +07:00
|
|
|
attributes 'Main-Class': project.mainClassName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-25 03:29:25 +07:00
|
|
|
task dzip(type: Zip){
|
|
|
|
from getServerFolder()
|
2019-11-16 07:48:26 +07:00
|
|
|
archiveFileName = "${generateDeployName('server')}.zip"
|
|
|
|
destinationDirectory = file("../deploy/")
|
2019-03-25 03:29:25 +07:00
|
|
|
|
|
|
|
finalizedBy 'cleanup'
|
|
|
|
}
|
|
|
|
|
|
|
|
task cleanup{
|
|
|
|
doLast{
|
|
|
|
delete{
|
|
|
|
delete getServerFolder()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task deploy{
|
2018-01-29 23:26:31 +07:00
|
|
|
dependsOn "dist"
|
2019-03-25 03:29:25 +07:00
|
|
|
|
|
|
|
finalizedBy 'dzip'
|
|
|
|
|
|
|
|
doLast{
|
|
|
|
copy{
|
|
|
|
from "build/libs/server-release.jar"
|
|
|
|
into getServerFolder()
|
|
|
|
rename("server-release.jar", "server.jar")
|
|
|
|
}
|
|
|
|
|
|
|
|
copy{
|
|
|
|
from "server_template"
|
|
|
|
into getServerFolder()
|
|
|
|
}
|
|
|
|
}
|
2018-01-29 23:26:31 +07:00
|
|
|
}
|
|
|
|
|
2018-01-28 11:42:42 +07:00
|
|
|
dist.dependsOn classes
|