-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
191 lines (172 loc) · 10.9 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
plugins {
id("java")
id("io.freefair.lombok") version "8.6"
id("com.diffplug.spotless") version "6.25.0"
id("com.avast.gradle.docker-compose") version "0.17.7"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
apply plugin: "com.diffplug.spotless"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
jar {
manifest {
attributes "Main-Class": "org.triplea.spitfire.server.SpitfireServerApplication"
}
}
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()
}
dockerCompose {
// useComposeFiles = ['docker-compose.yml', 'docker-compose.prod.yml'] // like 'docker-compose -f <file>'; default is empty
// startedServices = ['web'] // list of services to execute when calling 'docker-compose up' or 'docker-compose pull' (when not specified, all services are executed)
// scale = [${serviceName1}: 5, ${serviceName2}: 2] // Pass docker compose --scale option like 'docker-compose up --scale serviceName1=5 --scale serviceName2=2'
// forceRecreate = false // pass '--force-recreate' and '--renew-anon-volumes' when calling 'docker-compose up' when set to 'true`
// noRecreate = false // pass '--no-recreate' when calling 'docker-compose up' when set to 'true`
// buildBeforeUp = true // performs 'docker-compose build' before calling the 'up' command; default is true
// buildBeforePull = true // performs 'docker-compose build' before calling the 'pull' command; default is true
// ignorePullFailure = false // when set to true, pass '--ignore-pull-failure' to 'docker-compose pull'
// ignorePushFailure = false // when set to true, pass '--ignore-push-failure' to 'docker-compose push'
// pushServices = [] // which services should be pushed, if not defined then upon `composePush` task all defined services in compose file will be pushed (default behaviour)
// buildAdditionalArgs = ['--force-rm']
// pullAdditionalArgs = ['--ignore-pull-failures']
// upAdditionalArgs = ['--no-deps']
// downAdditionalArgs = ['--some-switch']
// composeAdditionalArgs = ['--context', 'remote', '--verbose', "--log-level", "DEBUG"] // for adding more [options] in docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
//
// waitForTcpPorts = true // turns on/off the waiting for exposed TCP ports opening; default is true
// waitForTcpPortsTimeout = java.time.Duration.ofMinutes(15) // how long to wait until all exposed TCP become open; default is 15 minutes
// waitAfterTcpProbeFailure = java.time.Duration.ofSeconds(1) // how long to sleep before next attempt to check if a TCP is open; default is 1 second
// tcpPortsToIgnoreWhenWaiting = [1234] // list of TCP ports what will be ignored when waiting for exposed TCP ports opening; default: empty list
// waitForHealthyStateTimeout = java.time.Duration.ofMinutes(15) // how long to wait until a container becomes healthy; default is 15 minutes
// waitAfterHealthyStateProbeFailure = java.time.Duration.ofSeconds(5) // how long to sleep before next attempt to check healthy status; default is 5 seconds
// checkContainersRunning = true // turns on/off checking if container is running or restarting (during waiting for open TCP port and healthy state); default is true
//
captureContainersOutput = true // if true, prints output of all containers to Gradle output - very useful for debugging; default is false
// captureContainersOutputToFile = project.file('/path/to/logFile') // sends output of all containers to a log file
// captureContainersOutputToFiles = project.file('/path/to/directory') // sends output of all services to a dedicated log file in the directory specified, e.g. 'web.log' for service named 'log'
// composeLogToFile = project.file('build/my-logs.txt') // redirect output of composeUp and composeDown tasks to this file; default is null (ouput is not redirected)
// containerLogToDir = project.file('build/logs') // directory where composeLogs task stores output of the containers; default: build/containers-logs
// includeDependencies = false // calculates services dependencies of startedServices and includes those when gathering logs or removing containers; default is false
//
// stopContainers = true // doesn't call `docker-compose down` if set to false - see below the paragraph about reconnecting; default is true
// removeContainers = true // default is true
// retainContainersOnStartupFailure = false // if set to true, skips running ComposeDownForced task when ComposeUp fails - useful for troubleshooting; default is false
// removeImages = com.avast.gradle.dockercompose.RemoveImages.None // Other accepted values are All and Local
// removeVolumes = true // default is true
// removeOrphans = false // removes containers for services not defined in the Compose file; default is false
//
projectName = 'lobby' // allow to set custom docker-compose project name (defaults to a stable name derived from absolute path of the project and nested settings name), set to null to Docker Compose default (directory name)
// projectNamePrefix = 'my_prefix_' // allow to set custom prefix of docker-compose project name, the final project name has nested configuration name appended
// executable = '/path/to/docker-compose' // allow to set the base Docker Compose command (useful if not present in PATH). Defaults to `docker-compose`. Ignored if useDockerComposeV2 is set to true.
// useDockerComposeV2 = true // Use Docker Compose V2 instead of Docker Compose V1, default is true. If set to true, `dockerExecutable compose` is used for execution, so executable property is ignored.
// dockerExecutable = '/path/to/docker' // allow to set the path of the docker executable (useful if not present in PATH)
// dockerComposeWorkingDirectory = project.file('/path/where/docker-compose/is/invoked/from')
// dockerComposeStopTimeout = java.time.Duration.ofSeconds(20) // time before docker-compose sends SIGTERM to the running containers after the composeDown task has been started
// environment.put 'BACKEND_ADDRESS', '192.168.1.100' // environment variables to be used when calling 'docker-compose', e.g. for substitution in compose file
}
composeBuild.dependsOn shadowJar
dockerCompose.isRequiredBy(test)
repositories {
mavenCentral()
maven {
url "https://maven.pkg.github.com/triplea-game/triplea"
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.property("triplea.github.username")
password = System.getenv("GH_TOKEN") ?: project.property("triplea.github.access.token")
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.incremental = true
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging {
exceptionFormat = "full"
events = ["standardOut", "standardError", "skipped", "failed"]
}
testLogging {
exceptionFormat = "full"
events = ["standardOut", "standardError", "skipped", "failed"]
}
}
test.doFirst {
// exposes "${serviceName}_HOST" and "${serviceName}_TCP_${exposedPort}" environment variables
// for example exposes "WEB_HOST" and "WEB_TCP_80" environment variables for service named `web` with exposed port `80`
// if service is scaled using scale option, environment variables will be exposed for each service instance like "WEB_1_HOST", "WEB_1_TCP_80", "WEB_2_HOST", "WEB_2_TCP_80" and so on
dockerCompose.exposeAsEnvironment(test)
}
spotless {
java {
googleJavaFormat()
removeUnusedImports()
}
}
ext {
awaitilityVersion = "4.2.1"
bcryptVersion = "0.10.2"
databaseRiderVersion = "1.43.0"
dropwizardVersion = "4.0.7"
dropwizardWebsocketsVersion = "1.3.14"
feignVersion = "13.2.1"
hamcrestJsonVersion = "0.3"
jakartaMailVersion = "2.0.1"
javaWebSocketVersion = "1.5.7"
javaxActivationVersion = "1.1.1"
jaxbApiVersion = "2.3.1"
jaxbCoreVersion = "4.0.5"
jaxbImplVersion = "4.0.5"
jdbiVersion = "3.45.1"
junitJupiterVersion = "5.10.2"
junitPlatformLauncherVersion = "1.10.2"
mockitoVersion = "5.11.0"
openFeignVersion = "13.3"
postgresqlVersion = "42.7.3"
tripleaClient = "2.7.14846"
wireMockJunit5Version = "1.3.1"
}
dependencies {
implementation "at.favre.lib:bcrypt:$bcryptVersion"
implementation "be.tomcools:dropwizard-websocket-jsr356-bundle:4.0.0"
implementation "com.sun.mail:jakarta.mail:$jakartaMailVersion"
implementation "com.sun.xml.bind:jaxb-core:$jaxbCoreVersion"
implementation "com.sun.xml.bind:jaxb-impl:$jaxbImplVersion"
implementation "io.dropwizard:dropwizard-auth:$dropwizardVersion"
implementation "io.dropwizard:dropwizard-core:$dropwizardVersion"
implementation "io.dropwizard:dropwizard-jdbi3:$dropwizardVersion"
implementation "io.github.openfeign:feign-core:$openFeignVersion"
implementation "io.github.openfeign:feign-gson:$openFeignVersion"
implementation "javax.activation:activation:$javaxActivationVersion"
implementation "javax.servlet:servlet-api:2.5"
implementation "javax.xml.bind:jaxb-api:$jaxbApiVersion"
implementation "org.java-websocket:Java-WebSocket:$javaWebSocketVersion"
implementation "org.jdbi:jdbi3-core:$jdbiVersion"
implementation "org.jdbi:jdbi3-sqlobject:$jdbiVersion"
implementation "triplea:domain-data:$tripleaClient"
implementation "triplea:feign-common:$tripleaClient"
implementation "triplea:java-extras:$tripleaClient"
implementation "triplea:lobby-client:$tripleaClient"
implementation "triplea:websocket-client:$tripleaClient"
runtimeOnly "org.postgresql:postgresql:$postgresqlVersion"
testImplementation "com.github.database-rider:rider-junit5:$databaseRiderVersion"
testImplementation "com.github.npathai:hamcrest-optional:2.0.0"
testImplementation "com.sun.mail:jakarta.mail:$jakartaMailVersion"
testImplementation "io.dropwizard:dropwizard-testing:$dropwizardVersion"
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
testImplementation "org.jdbi:jdbi3-core:$jdbiVersion"
testImplementation "org.jdbi:jdbi3-sqlobject:$jdbiVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion"
testImplementation "org.wiremock:wiremock:3.7.0"
testImplementation "ru.lanwen.wiremock:wiremock-junit5:1.3.1"
testImplementation "uk.co.datumedge:hamcrest-json:$hamcrestJsonVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:$junitPlatformLauncherVersion"
}