-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
243 lines (217 loc) · 7.11 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
}
}
plugins {
id "com.google.protobuf" version "0.8.18"
id "java"
id 'pl.allegro.tech.build.axion-release' version '1.8.1'
// id 'com.github.johnrengelman.shadow' version '6.1.0'
}
//jar {
// manifest {
// attributes 'Multi-Release': 'true'
// }
//}
scmVersion {
useHighestVersion = true
tag {
prefix = 'v'
versionSeparator = ''
}
repository {
pushTagsOnly = true
}
branchVersionIncrementer = [
'master': 'incrementMajor',
'stage' : 'incrementMinor',
'dev' : 'incrementPatch'
]
hooks {
pre {
context ->
println "current version is " + context.currentVersion
(new File(System.getProperty("user.dir") + "/core/assets/project.version")).write(context.currentVersion)
executeCommand("git fetch")
executeCommand("git add .")
executeCommand("git status")
executeCommand("git -c user.name=\"Version_Bump\" -c user.email=\"\" commit -m \"Version_Bump\"")
if (project.hasProperty("push")) {
println "PUSHING LAST COMMIT"
executeCommand("git push origin")
}
}
}
}
project.version = scmVersion.version
def executeCommand(String command) {
println "executeCommand: " + command
def proc = command.execute()
proc.waitFor()
println "Process exit code: ${proc.exitValue()}"
def result = proc.in.text
println "Std Err: ${proc.err.text}"
println "Std Out: $result"
if (proc.exitValue() != 0) {
sleep(3 * 1000)
throw new GradleException('error occurred')
}
}
def protobufVersion = '3.0.0'
def grpcVersion = '1.32.1'
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "my-gdx-game"
gdxVersion = '1.9.12'
roboVMVersion = '2.3.11'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
aiVersion = '1.8.2'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":core") {
apply plugin: "java-library"
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
implementation 'junit:junit:4.12'
implementation 'io.grpc:grpc-netty:1.32.1'
implementation 'io.grpc:grpc-okhttp:1.32.1'
implementation 'io.grpc:grpc-protobuf:1.32.1'
implementation 'io.grpc:grpc-stub:1.32.1'
implementation "io.grpc:grpc-services:1.32.1"
implementation 'org.apache.tomcat:annotations-api:6.0.53'
implementation 'com.google.inject:guice:4.0:no_aop'
implementation "com.google.guava:guava:31.1-jre"
testImplementation 'org.hamcrest:hamcrest-library:2.1'
testImplementation "org.mockito:mockito-all:1.9.5"
testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
testImplementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.google.code.gson:gson:2.8.5'
}
sourceSets {
main {
java {
srcDirs = ["src/"]
}
resources {
srcDirs = ["../core/assets"]
}
proto {
srcDir 'src/proto'
include '**/*.proto'
}
}
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
implementation 'com.google.inject:guice:4.0:no_aop'
}
}
task buildEXE {
dependsOn tasks.getByPath(':desktop:dist')
doFirst {
delete 'out'
exec {
workingDir "."
commandLine 'java', '-jar', 'packr-all-4.0.0.jar', '--jdk', 'https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_windows_hotspot_11.0.14.1_1.zip', '--platform', 'windows64', '--executable', 'myapp', '--classpath', 'desktop/build/libs/desktop-1.0.jar', '--mainclass', 'main.ClientGameMain', '--vmargs', 'Xmx1G', '--output', 'out'
}
}
doLast {
def ENV = System.getenv("ENV") ?: "prod"
copy {
from file('environment/' + ENV + '.config.properties')
into 'out/'
rename { 'config.properties' }
}
}
}
task zipit(type: Zip) {
dependsOn tasks.getByPath('buildEXE')
delete file("$projectDir/dist/game.zip")
archiveFileName = "game.zip"
destinationDirectory = file("$projectDir/dist")
from "out"
}
clean {
delete "dist", "out"
}
task writeAllAssetsToFile {
doLast {
def assetsFolder = new File("${project.rootDir}/core/assets/")
FileFilter isDir = new FileFilter() {
boolean accept(File file) {
return file.isDirectory();
}
};
FileFilter isFile = new FileFilter() {
boolean accept(File file) {
return file.isFile();
}
};
def handle_folder
handle_folder = {
File folder ->
def assetsFile = new File(folder, "assets.txt")
assetsFile.delete()
folder.listFiles(isFile).collect { assetsFolder.relativePath(it) }.each {
assetsFile.append(it + "\n")
}
folder.listFiles(isDir).each {
handle_folder(it)
}
}
handle_folder(assetsFolder)
}
}