-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
143 lines (122 loc) · 4.26 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
plugins {
id 'java'
id "com.diffplug.spotless" version "6.11.0"
}
group mod_org_id
version mod_version
// Still requires java 8 to build, because newer gradle versions require Java 8!
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
repositories {
mavenCentral()
}
configurations {
implementation.extendsFrom(jarLibs)
}
dependencies {
testImplementation 'junit:junit:4.13'
implementation files(starmade_root_client + 'StarMade.jar')
implementation fileTree(dir: starmade_root_client + 'lib', include: ["*.jar"])
jarLibs files("lib/MapDrawerUtils.jar")
jarLibs files("lib/ModGlossar.jar")
}
jar {
//noinspection GroovyAssignabilityCheck
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest {
//noinspection GroovyAssignabilityCheck
attributes([
'Built-By': System.getProperty("user.name"),
'url': mod_url,
'Implementation-Title': mod_name,
'Implementation-Version': mod_version,
'Implementation-Vendor-Id': mod_org_id,
'Implementation-Vendor': mod_org
])
}
from {
configurations.jarLibs.collect {zipTree it }
}
doLast {
File jarFile = jar.archiveFile.get().asFile
copy {
from jarFile.getParent()
into starmade_root_client + "mods"
include jarFile.getName()
}
jarFile = jar.archiveFile.get().asFile
copy {
from jarFile.getParent()
into starmade_root_server + "mods"
include jarFile.getName()
}
}
}
spotless {
// optional: limit format enforcement to just the files changed by this feature branch
//ratchetFrom 'origin/master'
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Use the default importOrder configuration
println("use custom import order")
importOrder('java', 'javax', 'org', 'com', 'com.diffplug', '') // A sequence of package names
println("remove unused imports")
removeUnusedImports() // removes any unused imports
}
}
tasks.jar.dependsOn(tasks.spotlessApply)
task runGameClient(type: JavaExec) {
group = 'Game'
description = 'Run the game with the mod injected for debugging.'
classpath = sourceSets.main.compileClasspath
mainClass.set('me.jakev.starloader.LaunchClassLoader')
systemProperty('java.library.path', starmade_root_client + "native" + System.getProperty('path.separator') + starmade_root_client + "native/windows/x64" + System.getProperty('path.separator') + starmade_root_client + "native/solaris/x64")
//noinspection GroovyAssignabilityCheck
args = ["-client","-force","-uplink 127.0.0.1 4242 8166,-1"]
doFirst {
//noinspection GroovyAssignabilityCheck
workingDir = new File(starmade_root_client)
}
}
tasks.runGameClient.dependsOn(tasks.build)
task runGameServer(type: JavaExec) {
group = 'Game'
description = 'Run the game with the mod injected for debugging.'
classpath = sourceSets.main.compileClasspath
mainClass.set('me.jakev.starloader.LaunchClassLoader')
systemProperty('java.library.path', starmade_root_server + "native" + System.getProperty('path.separator') + starmade_root_server + "native/windows/x64" + System.getProperty('path.separator') + starmade_root_server + "native/solaris/x64")
//noinspection GroovyAssignabilityCheck
args = ["-server"]
doFirst {
//noinspection GroovyAssignabilityCheck
workingDir = new File(starmade_root_server)
}
}
tasks.runGameServer.dependsOn(tasks.build)
task runGameServerAsClient(type: JavaExec) {
group = 'Game'
description = 'Run the game with the mod injected for debugging.'
classpath = sourceSets.main.compileClasspath
mainClass.set('me.jakev.starloader.LaunchClassLoader')
systemProperty('java.library.path', starmade_root_server + "native" + System.getProperty('path.separator') + starmade_root_server + "native/windows/x64" + System.getProperty('path.separator') + starmade_root_server + "native/solaris/x64")
//noinspection GroovyAssignabilityCheck
args = ["-force"]
doFirst {
//noinspection GroovyAssignabilityCheck
workingDir = new File(starmade_root_server)
}
}
tasks.runGameServerAsClient.dependsOn(tasks.build)
test {
useJUnit()
maxHeapSize = '2G'
}
tasks.check.dependsOn(tasks.spotlessApply)
tasks.build.dependsOn(tasks.test)