-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
373 lines (318 loc) · 12.2 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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
import com.install4j.gradle.Install4jTask
import org.gradle.internal.os.OperatingSystem
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:3.0.2"
}
}
plugins {
id "com.install4j.gradle" version "10.0.4"
id "de.undercouch.download" version "5.3.0"
id 'jacoco'
}
// source: https://github.com/mendhak/Gradle-Travis-Colored-Output/blob/master/ColoredOutput.gradle
tasks.withType(Test) {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
String ANSI_BOLD_WHITE = "\u001B[0;1m";
String ANSI_RESET = "\u001B[0m";
String ANSI_BLACK = "\u001B[30m";
String ANSI_RED = "\u001B[31m";
String ANSI_GREEN = "\u001B[32m";
String ANSI_YELLOW = "\u001B[33m";
String ANSI_BLUE = "\u001B[34m";
String ANSI_PURPLE = "\u001B[35m";
String ANSI_CYAN = "\u001B[36m";
String ANSI_WHITE = "\u001B[37m";
String CHECK_MARK = "\u2713";
String NEUTRAL_FACE = "\u0CA0_\u0CA0";
String X_MARK = "\u274C";
String indent = '\t';
def outputCache = new HashMap<TestDescriptor, List<String>>()
beforeTest { TestDescriptor descriptor -> outputCache.put(descriptor, new ArrayList()) }
onOutput { TestDescriptor descriptor, TestOutputEvent testOutputEvent ->
def outputLines = outputCache.get(descriptor)
if (outputLines != null) {
outputLines.add(testOutputEvent.getMessage())
}
}
afterTest { TestDescriptor descriptor, TestResult result ->
if (result.failedTestCount > 0) {
String output = outputCache.remove(descriptor).join(indent)
def nameParts = descriptor.parent.name.split("\\.")
def simpleParentName = nameParts[nameParts.length - 1]
out.println()
out.println(simpleParentName + " > " + descriptor.name + " STANDARD_OUT")
out.println(indent + output)
out.println()
}
}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def failStyle = ANSI_RED
def skipStyle = ANSI_YELLOW
def summaryStyle = ANSI_WHITE
switch (result.resultType) {
case TestResult.ResultType.SUCCESS:
summaryStyle = ANSI_GREEN;
break;
case TestResult.ResultType.FAILURE:
summaryStyle = ANSI_RED;
break;
}
out.println("--------------------------------------------------------------------------");
out.println("Results: " + summaryStyle + " ${result.resultType} " + ANSI_RESET
+ " (${result.testCount} tests, "
+ ANSI_GREEN + " ${result.successfulTestCount} passed " + ANSI_RESET
+ ", " + failStyle + " ${result.failedTestCount} failed " + ANSI_RESET
+ ", " + skipStyle + " ${result.skippedTestCount} skipped " + ANSI_RESET
+ ")");
out.println("--------------------------------------------------------------------------");
}
}
}
//Specify jacoco version to work with java17
jacoco {
toolVersion = "0.8.7"
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'distribution'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
// 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.enabled = true
}
}
test {
useJUnitPlatform()
systemProperties = [
'junit.jupiter.execution.parallel.enabled': true
]
testLogging {
exceptionFormat = 'full'
}
}
configurations {
codacy
}
bootRun {
main = "com.faforever.client.Main"
jvmArgs = [
"-DnativeDir=build/resources/native",
"-Dprism.forceGPU=true",
"-Xms128m",
"-Xmx712m",
"-XX:MinHeapFreeRatio=15",
"-XX:MaxHeapFreeRatio=33",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseStringDeduplication",
"-XX:ConcGCThreads=1",
"-XX:ParallelGCThreads=1",
"-XX:+UseG1GC",
"-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"
}
}
distributions {
main {
contents {
from {
[
configurations.runtimeClasspath,
jar,
downloadIceAdapter.outputs.files,
downloadUnixUid.outputs.files,
downloadWindowsUid.outputs.files
]
}
exclude('**/i4jruntime*.jar')
}
}
}
install4j {
if (project.hasProperty('install4jHomeDir')) {
installDir = file(install4jHomeDir)
}
if (project.hasProperty('install4jLicense')) {
license = install4jLicense
}
}
task buildInstall4jMediaFiles(type: Install4jTask) {
group "distribution"
description 'Creates install4j media files'
dependsOn 'installDist'
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
}
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')
}
}
}
task downloadIceAdapter(type: 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
}
task downloadUnixUid(type: 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
doLast {
file("${buildDir}/resources/native/faf-uid").setExecutable(true, false)
}
}
task downloadWindowsUid(type: 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
}
task downloadNativeDependencies(dependsOn: [downloadUnixUid, downloadWindowsUid, downloadIceAdapter]) {
group "native dependencies"
}
compileJava.dependsOn 'downloadNativeDependencies'
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
main = "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.security.oauth.boot:spring-security-oauth2-autoconfigure:2.6.8")
implementation("org.springframework:spring-web")
implementation("org.springframework:spring-websocket")
def commonsVersion = "b0a374fa17988e0a8249fcf9b6d3a511b476ef8d"
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:31.1-jre")
implementation("org.apache.commons:commons-compress:1.22")
implementation("net.java.dev.jna:jna:5.12.1")
implementation("net.java.dev.jna:jna-platform:5.13.0")
implementation("org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r")
implementation("org.jetbrains:annotations:24.0.0")
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.7")
implementation("com.github.micheljung:JJsonRpc:01a7fba5f4")
implementation("javax.inject:javax.inject:1")
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.11")
implementation("javax.annotation:javax.annotation-api:1.3.2")
implementation("com.github.ben-manes.caffeine:caffeine")
implementation("org.apache.httpcomponents:httpclient")
implementation("io.github.micheljung:fxstage:0.8.3")
implementation("io.github.micheljung:jfx-waitomo-theme:0.3.0")
implementation("org.kitteh.irc:client-lib:8.0.0")
def mapstructVersion = "1.5.3.Final"
implementation("org.mapstruct:mapstruct:${mapstructVersion}")
implementation("com.code-disaster.steamworks4j:steamworks4j:1.9.0")
def javafxVersion = "19"
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.1.2")
implementation("org.fxmisc.flowless:flowless:0.7.0")
implementation("de.codecentric.centerdevice:javafxsvg:1.3.0")
implementation("org.javassist:javassist:3.29.2-GA")
implementation("com.install4j:install4j-runtime:10.0.4")
testImplementation("com.squareup.okhttp3:okhttp")
testImplementation("com.squareup.okhttp3:mockwebserver")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.testfx:testfx-core:4.0.16-alpha") {
exclude module: 'guava'
}
testImplementation("io.projectreactor.netty:reactor-netty:1.1.2")
testImplementation("org.testfx:testfx-junit5:4.0.16-alpha")
testImplementation("com.natpryce.hamcrest:hamcrest-reflection:0.1-2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.testfx:openjfx-monocle:jdk-12.0.1+2")
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.5.2.Final")
compileOnly("org.projectlombok:lombok")
testCompileOnly("org.projectlombok:lombok")
codacy("com.github.codacy:codacy-coverage-reporter:-SNAPSHOT")
}