forked from PaulWoitaschek/Voice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
executable file
·45 lines (43 loc) · 1.39 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
plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.android.app) apply false
alias(libs.plugins.android.library) apply false
id("voice.ktlint")
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}
tasks {
val pullStrings = register<Exec>("pullStrings") {
executable = "tx"
args("pull", "--all")
}
val removeEmptyListings = register("removeEmptyListings") {
dependsOn(pullStrings)
mustRunAfter(pullStrings)
val listingsFolder = file("app/src/main/play/listings")
doLast {
(listingsFolder.listFiles()?.toList() ?: emptyList())
.filter { it.isDirectory }
.filterNot {
// don't remove the source language
it.name == "en-US"
}
.forEach { language ->
val contents = language.listFiles()?.toList() ?: emptyList()
val requiredListings = listOf("full-description.txt", "short-description.txt", "title.txt")
.map { File(language, it) }
if (!contents.containsAll(requiredListings)) {
logger.warn("Missing translations for ${language.name}. Delete listing.")
language.deleteRecursively()
}
}
}
}
register("importStrings") {
dependsOn(pullStrings, removeEmptyListings)
mustRunAfter(pullStrings, removeEmptyListings)
finalizedBy(":app:lintDebug")
}
}