forked from HMCL-dev/HMCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
107 lines (87 loc) · 2.51 KB
/
build.gradle.kts
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
plugins {
id("checkstyle")
}
group = "org.jackhuang"
version = "3.0"
subprojects {
apply {
plugin("java")
plugin("idea")
plugin("maven-publish")
plugin("checkstyle")
}
repositories {
flatDir {
name = "libs"
dirs = setOf(rootProject.file("lib"))
}
mavenCentral()
maven(url = "https://jitpack.io")
maven(url = "https://libraries.minecraft.net")
}
tasks.withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.encoding = "UTF-8"
}
configure<CheckstyleExtension> {
sourceSets = setOf()
}
dependencies {
"testImplementation"("org.junit.jupiter:junit-jupiter:5.9.1")
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging.showStandardStreams = true
}
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
repositories {
mavenLocal()
}
}
}
tasks.create("checkTranslations") {
doLast {
val hmclLangDir = file("HMCL/src/main/resources/assets/lang")
val en = java.util.Properties().apply {
hmclLangDir.resolve("I18N.properties").bufferedReader().use { load(it) }
}
val zh = java.util.Properties().apply {
hmclLangDir.resolve("I18N_zh.properties").bufferedReader().use { load(it) }
}
val zh_CN = java.util.Properties().apply {
hmclLangDir.resolve("I18N_zh_CN.properties").bufferedReader().use { load(it) }
}
var success = true
zh_CN.forEach {
if (!en.containsKey(it.key)) {
project.logger.warn("I18N.properties missing key '${it.key}'")
success = false
}
}
zh_CN.forEach {
if (!zh.containsKey(it.key)) {
project.logger.warn("I18N_zh.properties missing key '${it.key}'")
success = false
}
}
zh_CN.forEach {
if (it.value.toString().contains("帐户")) {
project.logger.warn("The misspelled '帐户' in '${it.key}' should be replaced by '账户'")
success = false
}
}
if (!success) {
throw GradleException("Part of the translation is missing")
}
}
}
apply {
from("javafx.gradle.kts")
}
defaultTasks("clean", "build")