forked from Anuken/Mindustry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
90 lines (76 loc) · 2.18 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
sourceSets.main.java.srcDirs = ["src/"]
project.ext.mainClassName = "mindustry.server.ServerLauncher"
project.ext.assetsDir = new File("../core/assets")
ext.getServerFolder = {
return "../deploy/${appName}-server-${getVersionString()}"
}
task run(dependsOn: classes, type: JavaExec){
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
if(project.hasProperty("appArgs")){
args Eval.me(appArgs)
}
if(project.hasProperty("jvmArgs")){
jvmArgs((List<String>)Eval.me(project.getProperties()["jvmArgs"]))
}
}
task debug(dependsOn: classes, type: JavaExec){
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
task dist(type: Jar, dependsOn: configurations.runtimeClasspath){
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
from {configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }}
from files(project.assetsDir)
exclude("sprites/**")
exclude("music/**")
exclude("sounds/**")
exclude("fonts/**")
exclude("bundles/**")
exclude("cubemaps/**")
exclude("cursors/**")
exclude("shaders/**")
exclude("icons/icon.icns")
exclude("icons/icon.ico")
exclude("icons/icon_64.png")
manifest{
attributes 'Main-Class': project.mainClassName
}
}
task dzip(type: Zip){
from getServerFolder()
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