-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
53 lines (44 loc) · 1.58 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
plugins {
id 'org.screamingsandals.plugin-builder-lite' version "${SCREAMING_PLUGIN_BUILDER}" apply false
}
defaultTasks 'clean', 'screamCompile'
group = 'org.screamingsandals.language.bedwars'
version = TRANSLATION_BRANCH + '-SNAPSHOT'
apply plugin: 'org.screamingsandals.plugin-builder-lite' // we need to apply the plugin later
sourceSets {
main {
output.dir(new File(projectDir, "build/generated/buildinfo"), builtBy: 'generateBuildInfoFile')
resources {
srcDirs "."
include '/languages/**'
}
}
}
task generateBuildInfoFile {
def outputDir = new File(projectDir, "build/generated/buildinfo")
doFirst {
mkdir outputDir
new File(outputDir, "language_definition.json").withWriter { writer ->
def build
if (System.getenv('BUILD_NUMBER') != null) {
build = System.getenv('BUILD_NUMBER')
} else {
build = "custom"
}
def contents = "{\"branch\": \"${TRANSLATION_BRANCH}\", \"version\": \"${build}\", \"languages\":{"
def first = true
new File(projectDir, "languages").listFiles().each {
if (!first) {
contents += ","
} else {
first = false
}
def locale = (it.name =~ /[a-z]{2}-[A-Z][A-Za-z]{1,3}/).findAll()?.first()
contents += "\"${locale}\": \"languages/${it.name}\""
}
contents += "}}"
writer.write(contents)
}
}
}
sourceCompatibility = '11.0'