-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
224 lines (192 loc) · 7.75 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
import groovy.json.JsonSlurper
import java.nio.file.Paths
abstract class XGettextTask extends DefaultTask {
@TaskAction
void execute() {
def srcSearchPaths = ["android/assets", "android/src", "launcher/src", "desktop/src", "tools/src", "core/src"]
def gettextFiles = new HashSet<String>()
for ( path in srcSearchPaths ) {
project.fileTree path include "**/*.java", "**/*.js" visit { if (!it.directory) gettextFiles.add project.projectDir.getAbsoluteFile().toPath().relativize(it.file.getAbsoluteFile().toPath()); }
}
project.exec {
commandLine "xgettext --from-code=UTF-8 --add-comments -o i18n/messages.pot ${gettextFiles.join " "}".split(" ")
}
}
}
def xgettext = tasks.register("xgettext", XGettextTask)
abstract class CinXGettextTask extends DefaultTask {
String stringBlock(str) {
def block = ""
def parts = str.split "\n"
for ( int i = 0; i < parts.length; i++ ) {
block += '"'
block += parts[i]
block += '"'
if (i != parts.length - 1) {
block += "\n"
}
}
return block
}
@TaskAction
void execute() {
def srcSearchPaths = ["android/assets"]
def jsonSlurper = new JsonSlurper()
def cinFiles = new HashSet<FileTreeElement>()
for ( path in srcSearchPaths ) {
project.fileTree path include "**/cin*.json" visit { if (!it.directory) cinFiles.add it }
}
def po = new PrintWriter(new FileOutputStream(project.file("i18n/messages.pot"), true))
po.println()
for ( file in cinFiles ) {
def cin = jsonSlurper.parse file.file
for ( track in cin ) {
if ( !track.actions || !track.actions.keys ) {
continue
}
for ( action in track.actions.keys ) {
if ( !action.text || action["@class"] != "me.vinceh121.wanderer.cinematic.SubtitleKeyFrame" ) {
continue
}
po.print "#: "
po.println project.projectDir.getAbsoluteFile().toPath().relativize(file.file.getAbsoluteFile().toPath())
po.print "msgid "
po.println this.stringBlock(action.text)
po.println 'msgstr ""\n'
}
}
}
po.flush()
}
}
def cinxgettext = tasks.register("cinxgettext", CinXGettextTask)
cinxgettext.configure { dependsOn(xgettext) }
abstract class MsguniqTask extends DefaultTask {
@TaskAction
void execute() {
project.exec { commandLine "msguniq -o i18n/messages.pot i18n/messages.pot".split(" ") }
}
}
def msguniq = tasks.register("msguniq", MsguniqTask)
abstract class MsgmergeTask extends DefaultTask {
@TaskAction
void execute() {
def transFiles = new HashSet<FileTreeElement>()
project.fileTree "./i18n/" include "*.po" visit { if (!it.directory) transFiles.add it }
for ( trans in transFiles ) {
project.exec { commandLine "msgmerge -U --previous i18n/${trans.name} i18n/messages.pot".split(" ") }
}
}
}
def msgmerge = tasks.register("msgmerge", MsgmergeTask)
tasks.register("i18n") { dependsOn(xgettext, cinxgettext, msguniq/*, msgmerge*/) };
buildscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
}
}
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "wanderer"
gdxVersion = '1.12.1'
aiVersion = '1.8.2'
gdxControllersVersion = '2.2.3'
jlineVersion = '3.26.3'
log4jVersion = '2.23.1'
}
repositories {
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url "https://jitpack.io" }
maven { url "https://maven.vinceh121.me/snapshots" }
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
api project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion"
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
api "org.jline:jline-terminal-jansi:$jlineVersion"
}
}
/*project(":android") {
apply plugin: "com.android.application"
configurations { natives }
dependencies {
api project(":core")
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64"
api "com.badlogicgames.gdx-controllers:gdx-controllers-android:$gdxControllersVersion"
}
}*/
project(":tools") {
apply plugin: "java-library"
dependencies {
api project(":core")
api "info.picocli:picocli:4.7.1"
api "me.vinceh121.wanderer:nebula2-assets-extractor:0.5.0-SNAPSHOT"
}
}
project(":launcher") {
apply plugin: "java-library"
apply plugin: "application"
dependencies {
api "me.vinceh121.wanderer:nebula2-assets-extractor:0.5.0-SNAPSHOT"
api "org.apache.logging.log4j:log4j-core:$log4jVersion"
api "org.apache.logging.log4j:log4j-slf4j2-impl:$log4jVersion"
}
}
project(":core") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion"
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
api "org.mozilla:rhino:1.7.14"
api "com.fasterxml.jackson.core:jackson-databind:2.13.3"
api "org.apache.commons:commons-collections4:4.4"
api "org.apache.commons:commons-lang3:3.12.0"
api "org.jline:jline:$jlineVersion"
api "org.jline:jline-reader:$jlineVersion"
api "org.jline:jline-terminal:$jlineVersion"
api "com.github.mgsx-dev.gdx-gltf:gltf:4220b1020bad4c681fff8caf23f27cd152aa115a"
api "org.reflections:reflections:0.10.2"
api "org.apache.logging.log4j:log4j-core:$log4jVersion"
api "org.apache.logging.log4j:log4j-slf4j2-impl:$log4jVersion"
api "com.electronwill.night-config:toml:3.6.6"
testImplementation(platform("org.junit:junit-bom:5.10.1"))
testImplementation "org.junit.jupiter:junit-jupiter:5.10.1"
}
test {
useJUnitPlatform()
testLogging { events "passed", "skipped", "failed" }
}
}