mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Merge branch 'improve-gradle' into dev
This commit is contained in:
102
gradle/libs.versions.toml
Normal file
102
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,102 @@
|
||||
[versions]
|
||||
agp = "8.8.0"
|
||||
annotation = "1.9.1"
|
||||
appcompat = "1.7.0"
|
||||
appintro = "6.3.1"
|
||||
commonsCodec = "1.16.0"
|
||||
commonsIo = "1.3.2"
|
||||
commonsLang3 = "3.14.0"
|
||||
dagger = "2.55"
|
||||
desugar = "2.1.4"
|
||||
dexmaker = "2.28.3"
|
||||
espresso = "3.6.1"
|
||||
guava = "33.2.1-android"
|
||||
hamcrest = "2.2"
|
||||
jsr250 = "1.0"
|
||||
jsr305 = "3.0.2"
|
||||
junit = "1.2.1"
|
||||
junitJupiter = "5.10.1"
|
||||
junitVersion = "4.13.2"
|
||||
konfetti-xml = "2.0.2"
|
||||
kotlin = "2.1.10"
|
||||
kotlinxCoroutinesCoreCommon = "1.3.8"
|
||||
ksp = "2.1.10-1.0.30"
|
||||
ktlint-plugin = "11.6.1"
|
||||
ktor = "1.6.8"
|
||||
ktxCoroutine = "1.10.1"
|
||||
legacy-support = "1.0.0"
|
||||
material = "1.12.0"
|
||||
mockito-kotlin = "5.4.0"
|
||||
opencsv = "5.9"
|
||||
rules = "1.6.1"
|
||||
shadow = "8.1.1"
|
||||
sqliteJdbc = "3.45.1.0"
|
||||
uiautomator = "2.3.0"
|
||||
|
||||
[libraries]
|
||||
annotation = { group = "androidx.annotation", name = "annotation", version.ref = "annotation" }
|
||||
appIntro = { group = "com.github.AppIntro", name = "AppIntro", version.ref = "appintro" }
|
||||
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||
commons-codec = { module = "commons-codec:commons-codec", version.ref = "commonsCodec" }
|
||||
commons-io = { module = "org.apache.commons:commons-io", version.ref = "commonsIo" }
|
||||
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commonsLang3" }
|
||||
dagger = { group = "com.google.dagger", name = "dagger", version.ref = "dagger" }
|
||||
dagger-compiler = { group = "com.google.dagger", name = "dagger-compiler", version.ref = "dagger" }
|
||||
desugar_jdk_libs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "desugar" }
|
||||
dexmaker-mockito = { group = "com.linkedin.dexmaker", name = "dexmaker-mockito", version.ref = "dexmaker" }
|
||||
espresso-contrib = { group = "androidx.test.espresso", name = "espresso-contrib", version.ref = "espresso" }
|
||||
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" }
|
||||
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
|
||||
jsr250-api = { group = "javax.annotation", name = "jsr250-api", version.ref = "jsr250" }
|
||||
jsr305 = { group = "com.google.code.findbugs", name = "jsr305", version.ref = "jsr305" }
|
||||
junit = { group = "androidx.test.ext", name = "junit", version.ref = "junit" }
|
||||
junit-junit = { module = "junit:junit", version.ref = "junitVersion" }
|
||||
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junitJupiter" }
|
||||
konfetti-xml = { group = "nl.dionsegijn", name = "konfetti-xml", version.ref = "konfetti-xml" }
|
||||
kotlin-stdlib-jdk8 = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
|
||||
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "ktxCoroutine" }
|
||||
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "ktxCoroutine" }
|
||||
kotlinx-coroutines-core-common = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-common", version.ref = "kotlinxCoroutinesCoreCommon" }
|
||||
kotlinx-coroutines-core-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "ktxCoroutine" }
|
||||
ktor-client-android = { group = "io.ktor", name = "ktor-client-android", version.ref = "ktor" }
|
||||
ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" }
|
||||
ktor-client-jackson = { group = "io.ktor", name = "ktor-client-jackson", version.ref = "ktor" }
|
||||
ktor-client-json = { group = "io.ktor", name = "ktor-client-json", version.ref = "ktor" }
|
||||
ktor-client-mock = { group = "io.ktor", name = "ktor-client-mock", version.ref = "ktor" }
|
||||
ktor-jackson = { group = "io.ktor", name = "ktor-jackson", version.ref = "ktor" }
|
||||
legacy-preference-v14 = { group = "androidx.legacy", name = "legacy-preference-v14", version.ref = "legacy-support" }
|
||||
legacy-support-v4 = { group = "androidx.legacy", name = "legacy-support-v4", version.ref = "legacy-support" }
|
||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||
mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", version.ref = "mockito-kotlin" }
|
||||
opencsv = { group = "com.opencsv", name = "opencsv", version.ref = "opencsv" }
|
||||
rules = { group = "androidx.test", name = "rules", version.ref = "rules" }
|
||||
sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqliteJdbc" }
|
||||
uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "uiautomator" }
|
||||
|
||||
[bundles]
|
||||
androidTest = [
|
||||
"annotation",
|
||||
"dagger",
|
||||
"dexmaker-mockito",
|
||||
"espresso-contrib",
|
||||
"espresso-core",
|
||||
"junit",
|
||||
"ktor-client-mock",
|
||||
"ktor-jackson",
|
||||
"mockito-kotlin",
|
||||
"rules",
|
||||
"uiautomator"
|
||||
]
|
||||
test = [
|
||||
"dagger",
|
||||
"junit-junit",
|
||||
"mockito-kotlin",
|
||||
]
|
||||
|
||||
[plugins]
|
||||
agp = { id = "com.android.application", version.ref = "agp" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||
ktlint-plugin = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-plugin" }
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||
138
gradle/translators.gradle.kts
Normal file
138
gradle/translators.gradle.kts
Normal file
@@ -0,0 +1,138 @@
|
||||
import com.opencsv.CSVReaderHeaderAware
|
||||
import groovy.util.IndentPrinter
|
||||
import groovy.xml.MarkupBuilder
|
||||
import java.io.FileReader
|
||||
import java.io.StringWriter
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
"classpath"(group = "com.opencsv", name = "opencsv", version = "5.4")
|
||||
}
|
||||
}
|
||||
|
||||
task("updateTranslators") {
|
||||
doLast {
|
||||
fun updateTranslatorLayouts() {
|
||||
val translators = mutableMapOf<String, MutableList<String>>()
|
||||
|
||||
// Classic
|
||||
var csv = CSVReaderHeaderAware(FileReader("translators-classic.csv"))
|
||||
while (true) {
|
||||
val entry = csv.readMap() ?: break
|
||||
val lang = entry["Language"]!!
|
||||
val name = entry["Name"]!!
|
||||
if (!translators.containsKey(lang)) {
|
||||
translators[lang] = mutableListOf()
|
||||
}
|
||||
translators[lang]!!.add(name)
|
||||
translators[lang]!!.sort()
|
||||
}
|
||||
|
||||
// Crowdin
|
||||
val languageMap = mapOf(
|
||||
"Arabic" to "العَرَبِية\u200E",
|
||||
"Basque" to "Euskara",
|
||||
"Bulgarian" to "Български",
|
||||
"Catalan" to "Català",
|
||||
"Chinese Simplified" to "中文",
|
||||
"Chinese Traditional" to "中文",
|
||||
"Croatian" to "Hrvatski",
|
||||
"Czech" to "Čeština",
|
||||
"Danish" to "Dansk",
|
||||
"Dutch" to "Nederlands",
|
||||
"Finnish" to "Suomen kieli",
|
||||
"French" to "Français",
|
||||
"German" to "Deutsch",
|
||||
"Greek" to "Ελληνικά",
|
||||
"Hebrew" to "עברית\u200E",
|
||||
"Hungarian" to "Magyar",
|
||||
"Indonesian" to "Bahasa Indonesia",
|
||||
"Italian" to "Italiano",
|
||||
"Japanese" to "日本語",
|
||||
"Korean" to "한국어",
|
||||
"Persian" to "العَرَبِية\u200E",
|
||||
"Polish" to "Polski",
|
||||
"Portuguese" to "Português",
|
||||
"Portuguese, Brazilian" to "Português",
|
||||
"Romanian" to "Română",
|
||||
"Russian" to "Русский",
|
||||
"Serbian (Cyrillic)" to "српски",
|
||||
"Serbian (Latin)" to "српски",
|
||||
"Spanish" to "Español",
|
||||
"Swedish" to "Svenska",
|
||||
"Tamil" to "தமிழ்\u200E",
|
||||
"Telegu" to "తెలుగు",
|
||||
"Turkish" to "Türkçe",
|
||||
"Ukrainian" to "Українська",
|
||||
"Vietnamese" to "Tiếng Việt"
|
||||
)
|
||||
csv = CSVReaderHeaderAware(FileReader("translators-crowdin.csv"))
|
||||
while (true) {
|
||||
val entry = csv.readMap() ?: break
|
||||
var lang = entry["Languages"]!!.split(";")[0]
|
||||
if (languageMap.containsKey(lang)) {
|
||||
lang = languageMap[lang]!!
|
||||
}
|
||||
val name = entry["Name"]!!.replace(Regex(" *\\(.*\\) *"), "")
|
||||
if (name.contains("REMOVED")) continue
|
||||
if (entry["Winning (Words)"]!!.toInt() < 10 &&
|
||||
entry["Translated (Words)"]!!.toInt() < 100 &&
|
||||
entry["Approved (Words)"]!!.toInt() <= 0
|
||||
) {
|
||||
continue
|
||||
}
|
||||
if (!translators.containsKey(lang)) {
|
||||
translators[lang] = mutableListOf()
|
||||
}
|
||||
if (translators[lang]!!.contains(name)) continue
|
||||
translators[lang]!!.add(name)
|
||||
translators[lang]!!.sort()
|
||||
}
|
||||
|
||||
val writer = StringWriter()
|
||||
val indent = " "
|
||||
val xml = MarkupBuilder(IndentPrinter(writer, indent))
|
||||
xml.doubleQuotes = true
|
||||
xml.withGroovyBuilder {
|
||||
"LinearLayout"(
|
||||
"style" to "@style/Card",
|
||||
"android:gravity" to "center",
|
||||
"xmlns:android" to "http://schemas.android.com/apk/res/android"
|
||||
) {
|
||||
"TextView"(
|
||||
"style" to "@style/CardHeader",
|
||||
"android:text" to "@string/translators",
|
||||
"android:textColor" to "?aboutScreenColor"
|
||||
)
|
||||
|
||||
xml.mkp.yield('\n' + indent)
|
||||
xml.mkp.comment("This list is automatically generated, do not edit manually.")
|
||||
|
||||
for ((lang, lang_translators) in translators.toSortedMap()) {
|
||||
"TextView"(
|
||||
"style" to "@style/About.Item.Language",
|
||||
"android:text" to lang
|
||||
)
|
||||
|
||||
for (t in lang_translators) {
|
||||
"TextView"(
|
||||
"style" to "@style/About.Item",
|
||||
"android:text" to t
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val newContent = writer.toString()
|
||||
val path = "uhabits-android/src/main/res/layout/about_translators.xml"
|
||||
val currentContent = file(path).readText()
|
||||
if (currentContent != newContent) {
|
||||
file(path).writeText(newContent)
|
||||
}
|
||||
}
|
||||
updateTranslatorLayouts()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user