-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
151 lines (130 loc) · 5.24 KB
/
build.gradle.kts
File metadata and controls
151 lines (130 loc) · 5.24 KB
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
plugins {
java
id("io.freefair.lombok") version "8.14.2"
id("com.diffplug.spotless") version "7.2.1"
id("com.avast.gradle.docker-compose") version "0.17.12"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/triplea-game/triplea")
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("triplea.github.username") as String?
password = System.getenv("GH_TOKEN") ?: project.findProperty("triplea.github.access.token") as String?
}
}
}
tasks.jar {
manifest {
attributes["Main-Class"] = "org.triplea.lobby.server.LobbyServerApplication"
}
}
tasks.shadowJar {
archiveClassifier.set("")
// mergeServiceFiles is needed by dropwizard
// Without this configuration parsing breaks and is unable to find connector type "http" for
// the following YAML snippet: server: {applicationConnectors: [{type: http, port: 8080}]
mergeServiceFiles()
}
/* "testInteg" runs tests that require a database or a server to be running */
val testInteg: SourceSet = sourceSets.create("testInteg") {
java {
java.srcDir("src/testInteg/java")
compileClasspath += sourceSets.main.get().output
runtimeClasspath += output + compileClasspath
}
}
configurations[testInteg.implementationConfigurationName].extendsFrom(configurations.testImplementation.get())
configurations[testInteg.runtimeOnlyConfigurationName].extendsFrom(configurations.testRuntimeOnly.get())
val testIntegTask = tasks.register<Test>("testInteg") {
group = "verification"
useJUnitPlatform()
testClassesDirs = sourceSets["testInteg"].output.classesDirs
classpath = sourceSets["testInteg"].runtimeClasspath
}
tasks.check {
dependsOn(testIntegTask)
}
///* docker compose used to set up integ tests, starts a server and database */
// See: https://github.com/avast/gradle-docker-compose-plugin
dockerCompose {
captureContainersOutput = true
isRequiredBy(testIntegTask)
setProjectName("lobby-server")
// suppress unset variable warning, assign variables to empty string (which will result in random port numbers)
environment = mapOf("DATABASE_PORT" to "", "SERVER_PORT" to "")
}
tasks.composeBuild {
dependsOn(tasks.shadowJar)
}
tasks.register<Exec>("dockerComposeClean") {
group = "docker"
description = "Docker compose stop and removes volumes"
commandLine("docker", "compose", "down", "--volumes")
}
tasks.clean {
dependsOn(tasks.findByName("dockerComposeClean"))
}
tasks.named<Test>("test") {
val dockerCompose = dockerCompose
doFirst {
dockerCompose.exposeAsEnvironment(this@named)
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("standardOut", "standardError", "skipped", "failed")
}
jvmArgs("-XX:+EnableDynamicAgentLoading")
}
spotless {
java {
googleJavaFormat()
removeUnusedImports()
}
}
val tripleaVersion = "2.7.15281"
dependencies {
implementation("at.favre.lib:bcrypt:0.10.2")
implementation("be.tomcools:dropwizard-websocket-jsr356-bundle:4.0.0")
implementation("com.sun.mail:jakarta.mail:2.0.2")
implementation("com.sun.xml.bind:jaxb-core:4.0.5")
implementation("com.sun.xml.bind:jaxb-impl:4.0.5")
implementation("io.dropwizard:dropwizard-auth:4.0.7")
implementation("io.dropwizard:dropwizard-core:4.0.7")
implementation("io.dropwizard:dropwizard-jdbi3:4.0.7")
implementation("io.github.openfeign:feign-core:13.6")
implementation("io.github.openfeign:feign-gson:13.6")
implementation("javax.activation:activation:1.1.1")
implementation("javax.servlet:servlet-api:2.5")
implementation("javax.xml.bind:jaxb-api:2.3.1")
implementation("org.java-websocket:Java-WebSocket:1.6.0")
implementation("org.jdbi:jdbi3-core:3.49.5")
implementation("org.jdbi:jdbi3-sqlobject:3.49.5")
implementation("triplea:domain-data:$tripleaVersion")
implementation("triplea:feign-common:$tripleaVersion")
implementation("triplea:java-extras:$tripleaVersion")
implementation("triplea:lobby-client:$tripleaVersion")
implementation("triplea:websocket-client:$tripleaVersion")
runtimeOnly("org.postgresql:postgresql:42.7.7")
testImplementation("com.github.database-rider:rider-junit5:1.43.0")
testImplementation("com.github.npathai:hamcrest-optional:2.0.0")
testImplementation("com.sun.mail:jakarta.mail:2.0.2")
testImplementation("io.dropwizard:dropwizard-testing:4.0.7")
testImplementation("org.awaitility:awaitility:4.3.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.13.4")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.13.4")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.13.4")
testImplementation("org.mockito:mockito-core:5.18.0")
testImplementation("org.mockito:mockito-junit-jupiter:5.18.0")
testImplementation("org.wiremock:wiremock:3.7.0")
testImplementation("ru.lanwen.wiremock:wiremock-junit5:1.3.1")
testImplementation("uk.co.datumedge:hamcrest-json:0.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.13.4")
}