-
Notifications
You must be signed in to change notification settings - Fork 122
/
build.gradle
307 lines (268 loc) · 9.87 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
import com.install4j.gradle.Install4jTask
import org.gradle.internal.os.OperatingSystem
plugins {
id("org.springframework.boot") version "3.3.5"
id("com.install4j.gradle") version "11.0.1"
id("de.undercouch.download") version "5.6.0"
id("jacoco")
id("java")
id("distribution")
id("me.champeau.jmh") version "0.7.2"
id("io.github.sheikah45.fx2j") version "0.1.0"
id("com.adarshr.test-logger") version "4.0.0"
}
apply plugin: 'io.spring.dependency-management'
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
// These are read from gradle.properties
version "${version}"
project.ext.javafxPlatform = "${javafxPlatform}"
bootJar.enabled = false
jar.enabled = true
if (javafxPlatform == "unspecified") {
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
project.ext.javafxPlatform = "linux"
break
case OperatingSystem.MAC_OS:
project.ext.javafxPlatform = "mac"
break
case OperatingSystem.WINDOWS:
project.ext.javafxPlatform = "win"
break
}
}
println "Platform is: ${javafxPlatform}"
compileJava.dependsOn(processResources)
processResources {
filesMatching('**/application.yml') {
filter {
it.replace('#faf-client.version#', project.version.toString())
}
}
}
configurations {
compile.exclude module: "assertj-core"
}
jacocoTestReport {
reports {
xml.getRequired().set(true)
html.getRequired().set(false)
}
}
test {
useJUnitPlatform()
dependsOn("fx2jJar")
systemProperties = [
'junit.jupiter.execution.parallel.enabled': true
]
testLogging {
exceptionFormat = 'full'
}
maxHeapSize = "1024m"
}
configurations {
codacy
}
distributions {
main {
contents {
from {
[
configurations.runtimeClasspath,
jar,
downloadIceAdapter.outputs.files,
downloadUnixUid.outputs.files,
downloadWindowsUid.outputs.files
]
}
exclude('**/i4jruntime*.jar')
}
}
}
bootRun {
mainClass = "com.faforever.client.Main"
jvmArgs = [
"-DnativeDir=build/resources/native",
"-Dprism.forceGPU=true",
"-Xmx1g",
"-XX:MinHeapFreeRatio=15",
"-XX:MaxHeapFreeRatio=33",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseZGC",
"-Dio.netty.allocator.type=unpooled",
"-Djava.net.preferIPv4Stack=true",
"-XX:TieredStopAtLevel=1",
// Needed for getting process handle via reflection
"--add-opens=java.base/java.lang=ALL-UNNAMED",
]
}
jar {
manifest {
attributes "Main-Class": "com.faforever.client.Main",
"Implementation-Title": "FAF Client",
"Implementation-Version": archiveVersion,
"Implementation-Vendor": "Forged Alliance Forever"
}
}
install4j {
if (project.hasProperty('install4jHomeDir')) {
installDir = file(install4jHomeDir)
}
if (project.hasProperty('install4jLicense')) {
license = install4jLicense
}
}
fx2j {
modularizeIfPossible = false
basePackage = "com.faforever.client.fx2j"
strict = true
}
testlogger {
theme = "standard-parallel"
showFullStackTraces = false
showPassed = false
showStandardStreams = false
}
tasks.register('buildInstall4jMediaFiles', Install4jTask) {
group "distribution"
description 'Creates install4j media files'
dependsOn 'installDist', "fx2jJar"
projectFile = file('faf-client.install4j')
release = version
switch (project.ext.javafxPlatform) {
case "linux":
mediaTypes = ['unixInstaller', 'unixArchive']
break
case "mac":
mediaTypes = ['macos', 'macosFolder', 'macosArchive', 'macosFolderArchive']
break
case "win":
mediaTypes = ['windows', 'windowsArchive']
break
}
it.doFirst {
println "Building version ${version}"
if (!project.hasProperty('install4jHomeDir')) {
throw new RuntimeException('Specify install4jHomeDir in gradle.properties and set it to an install4j installation directory')
}
}
}
tasks.register('downloadIceAdapter', Download) {
group "native dependencies"
src "https://github.com/FAForever/java-ice-adapter/releases/download/${iceAdapterVersion}/faf-ice-adapter-${iceAdapterVersion}-nojfx.jar"
dest file("${buildDir}/resources/native/faf-ice-adapter.jar")
onlyIfNewer true
}
tasks.register('downloadUnixUid', Download) {
group "native dependencies"
src "https://github.com/FAForever/uid/releases/download/v4.0.4/faf-uid"
dest file("${buildDir}/resources/native/faf-uid")
onlyIfNewer true
it.doLast {
file("${buildDir}/resources/native/faf-uid").setExecutable(true, false)
}
}
tasks.register('downloadWindowsUid', Download) {
group "native dependencies"
src "https://github.com/FAForever/uid/releases/download/v4.0.4/faf-uid.exe"
dest file("${buildDir}/resources/native/faf-uid.exe")
onlyIfNewer true
}
tasks.register('downloadNativeDependencies') {
dependsOn downloadUnixUid, downloadWindowsUid, downloadIceAdapter
group "native dependencies"
}
compileJava.dependsOn 'downloadNativeDependencies'
tasks.register('sendCoverageToCodacy', JavaExec) {
dependsOn jacocoTestReport
mainClass = "com.codacy.CodacyCoverageReporter"
classpath = configurations.codacy
args = ["-l", "Java", "-r", "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"]
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.ej-technologies.com/repository' }
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-cache")
implementation("org.springframework.boot:spring-boot-starter-logging")
implementation("org.springframework.boot:spring-boot-starter-websocket")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
implementation("org.springframework:spring-web")
implementation("org.springframework:spring-websocket")
implementation("io.projectreactor.addons:reactor-extra")
implementation("io.projectreactor:reactor-tools")
def commonsVersion = "fbaab3c"
implementation("com.github.FAForever.faf-java-commons:faf-commons-data:${commonsVersion}") {
exclude module: 'guava'
}
implementation("com.github.FAForever.faf-java-commons:faf-commons-api:${commonsVersion}")
implementation("com.github.FAForever.faf-java-commons:faf-commons-lobby:${commonsVersion}")
implementation("com.google.guava:guava:33.3.0-jre")
implementation("org.apache.commons:commons-compress:1.27.1")
implementation("net.java.dev.jna:jna:5.14.0")
implementation("net.java.dev.jna:jna-platform:5.14.0")
implementation("org.jetbrains:annotations:26.0.1")
implementation("com.neovisionaries:nv-i18n:1.29")
implementation("com.nativelibs4java:bridj:0.7.0")
implementation("org.luaj:luaj-jse:3.0.1")
implementation("commons-validator:commons-validator:1.9.0") {
exclude module: 'commons-logging'
}
implementation("com.github.micheljung:JJsonRpc:01a7fba5f4")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.github.rutledgepaulv:q-builders:1.6")
implementation("com.github.nsp:JSkills:8b333ec63d")
implementation("com.github.jasminb:jsonapi-converter:0.14")
implementation("javax.annotation:javax.annotation-api:1.3.2")
implementation("com.github.ben-manes.caffeine:caffeine")
implementation("io.github.micheljung:fxstage:0.8.3")
implementation("io.github.micheljung:jfx-waitomo-theme:0.3.0")
implementation("org.kitteh.irc:client-lib:9.0.0")
def mapstructVersion = "1.6.3"
implementation("org.mapstruct:mapstruct:${mapstructVersion}")
implementation("com.code-disaster.steamworks4j:steamworks4j:1.9.0")
def javafxVersion = "21"
implementation("org.openjfx:javafx-base:${javafxVersion}:${javafxPlatform}")
implementation("org.openjfx:javafx-controls:${javafxVersion}:${javafxPlatform}")
implementation("org.openjfx:javafx-graphics:${javafxVersion}:${javafxPlatform}")
implementation("org.openjfx:javafx-swing:${javafxVersion}:${javafxPlatform}")
implementation("org.openjfx:javafx-fxml:${javafxVersion}:${javafxPlatform}")
implementation("org.openjfx:javafx-web:${javafxVersion}:${javafxPlatform}")
implementation("org.openjfx:javafx-media:${javafxVersion}:${javafxPlatform}")
implementation("com.github.1-alex98:discord-rpc:1.6.2-jna")
implementation("org.controlsfx:controlsfx:11.2.1")
implementation("de.codecentric.centerdevice:javafxsvg:1.3.0") {
exclude module: 'commons-logging'
}
implementation("org.fxmisc.flowless:flowless:0.7.3")
implementation("org.javassist:javassist:3.30.2-GA")
implementation("io.github.sheikah45.fx2j:fx2j-api:0.1.0")
implementation("com.install4j:install4j-runtime:11.0.1")
testImplementation("org.instancio:instancio-junit:5.2.0")
testImplementation("com.squareup.okhttp3:okhttp")
testImplementation("com.squareup.okhttp3:mockwebserver")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.testfx:testfx-core:4.0.18") {
exclude module: 'guava'
}
testImplementation("io.projectreactor.netty:reactor-netty")
testImplementation("org.testfx:testfx-junit5:4.0.18")
testImplementation("com.natpryce.hamcrest:hamcrest-reflection:0.1-2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
annotationProcessor("org.projectlombok:lombok")
annotationProcessor("org.mapstruct:mapstruct-processor:${mapstructVersion}")
testAnnotationProcessor("org.projectlombok:lombok")
testAnnotationProcessor("org.mapstruct:mapstruct-processor:1.6.3")
compileOnly("org.projectlombok:lombok")
testCompileOnly("org.projectlombok:lombok")
codacy("com.github.codacy:codacy-coverage-reporter:-SNAPSHOT")
}