forked from delconis/atavism-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
215 lines (177 loc) · 6.55 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
plugins {
id 'java'
}
sourceCompatibility = 1.8
// ____ _ _
// | _ \ ___ _ __ ___ _ __ __| | ___ _ __ ___(_) ___ ___
// | | | |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \/ __|
// | |_| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \
// |____/ \___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/
// |_|
repositories {
mavenCentral()
}
dependencies {
implementation 'io.micrometer:micrometer-registry-prometheus:1.7.3'
implementation 'com.github.ben-manes.caffeine:caffeine:2.9.2'
implementation 'org.recast4j:recast:1.5.5'
implementation 'org.recast4j:detour:1.5.5'
implementation 'org.recast4j:detour-crowd:1.5.5'
implementation 'org.recast4j:detour-dynamic:1.5.5'
implementation 'org.recast4j:detour-extras:1.5.5'
implementation 'mysql:mysql-connector-java:8.0.28'
implementation 'com.google.code.gson:gson:2.9.1'
// JUnit Jupiter API and Engine for testing
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
// Use JUnit Jupiter BOM for consistent versioning
testImplementation platform('org.junit:junit-bom:5.7.0')
//local file
implementation files("$rootDir/atavism_server/dist/lib/atavism.jar")
}
// ____ _ _ _
// | __ ) _ _(_) | __| |
// | _ \| | | | | |/ _` |
// | |_) | |_| | | | (_| |
// |____/ \__,_|_|_|\__,_|
sourceSets {
main {
java {
// Include all the plugins
file("$rootDir/src/plugins").listFiles().each { File file ->
if (file.isDirectory()) {
def pluginSrcDir = "${file.path}/src"
if (new File(pluginSrcDir).exists()) {
srcDirs += pluginSrcDir
}
}
}
// Include the dependency Java files in 'lib'
// This is where AGIS sources should live
srcDir 'src/lib'
// Include any other specific directory as needed
include '**/*.java'
exclude '**/*Test.java'
}
}
}
jar {
archiveFileName = 'agis.jar'
// Assumes server dist files location
destinationDirectory = file("$rootDir/atavism_server/dist/lib")
// Exclude specific files that are known to cause duplicate issues
exclude 'META-INF/LICENSE', 'META-INF/LICENSE.txt'
// Alternatively, exclude all files in META-INF directory
exclude 'META-INF/**'
from sourceSets.main.output
exclude '**/*Test.class' // This excludes any compiled test classes
// Generating and configuring the manifest
manifest {
attributes(
'Manifest-Version': '1.0',
'Main-Class': 'atavism.agis.server.AllInOneServer'
)
}
// Ensuring the JAR task is built after compiling the sources
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
build {
dependsOn jar
dependsOn 'registerPlugins'
dependsOn 'registerPluginsMessages'
dependsOn 'setPluginsProperties'
dependsOn 'genertateWorldSh'
}
task install {
dependsOn build
}
// ____ _ _
// | _ \ _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_
// | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __|
// | |_| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_
// |____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__|
// |_|
task ('dev.reload') {
description "Builds agis.jar, deploys it and restarts the Atavism Server process in the world container"
group = 'Development:Build'
dependsOn build
doLast {
exec {
workingDir "$rootDir"
commandLine "$rootDir/buildSrc/docker-single-reload.sh"
}
}
}
task 'dev.up' {
description "Starts Docker containers for development"
group = 'Development:Docker'
dependsOn build
doLast {
dockerCompose('up', "docker/compose/development/single.yml", ['-d'])
}
}
task 'dev.down' {
description "Stops Docker containers for development"
group = 'Development:Docker'
doFirst {
dockerCompose('down', "docker/compose/development/single.yml")
}
}
task 'dev.restart' {
description "Restarts Docker containers for development"
group = 'Development:Docker'
dependsOn 'build', 'dev.down','dev.up'
}
task 'dev.logs' {
description "Display logs for the dev containers"
group = 'Development:Docker'
doFirst {
dockerCompose('logs', "docker/compose/development/single.yml", ["-f"])
}
}
def dockerCompose(String action, String composeFile, List<String> additionalArgs = []) {
def command = ['docker-compose', '-f', composeFile, action] + additionalArgs
println "Executing: ${command.join(' ')}"
exec {
workingDir "."
commandLine command
}
}
// ____ _ _ _
// / ___|___ __| | ___ __ _ ___ _ __ ___ _ __ __ _| |_(_) ___ _ __
// | | / _ \ / _` |/ _ \ / _` |/ _ \ '_ \ / _ \ '__/ _` | __| |/ _ \| '_ \
// | |__| (_) | (_| | __/ | (_| | __/ | | | __/ | | (_| | |_| | (_) | | | |
// \____\___/ \__,_|\___| \__, |\___|_| |_|\___|_| \__,_|\__|_|\___/|_| |_|
// |___/
task registerPlugins(type : RegisterPluginsTask) {
projectDir = project.projectDir
}
task registerPluginsMessages(type : RegisterPluginsMessagesTask) {
projectDir = project.projectDir
}
task setPluginsProperties(type : SetPluginsPropertiesTask) {
projectDir = project.projectDir
}
task genertateWorldSh(type : GenerateWorldShTask) {
projectDir = project.projectDir
}
task newPlugin(type: NewPluginTask) {
projectDir = projectDir.toString()
pluginName = project.hasProperty('pluginName') ? project.property('pluginName') : null
}
task newGenericMessage(type: NewGenericMessageTask) {
projectDir = projectDir.toString()
pluginName = project.hasProperty('pluginName') ? project.property('pluginName') : null
messageName = project.hasProperty('messageName') ? project.property('messageName') : null
}
// _____ _
// |_ _|__ ___| |_ ___
// | |/ _ \/ __| __/ __|
// | | __/\__ \ |_\__ \
// |_|\___||___/\__|___/
tasks.test {
useJUnitPlatform()
}