revert: Revert "Modularize the app"

Epic fail, not sure what happened, but I am sure that I don't want to spend the rest of the day debugging no error crash, I'll just try again later. It is what it is, I guess...
This commit is contained in:
Ahmad Ansori Palembani 2024-06-16 13:23:47 +07:00
parent 9a86f99799
commit f59f2346dc
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
290 changed files with 881 additions and 1663 deletions

View file

@ -1,42 +0,0 @@
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.TaskContainerScope
fun TaskContainerScope.registerLocalesConfigTask(project: Project): TaskProvider<Task> {
return with(project) {
register("generateLocalesConfig") {
val emptyResourcesElement = "<resources>\\s*</resources>|<resources/>".toRegex()
val valuesPrefix = "values-?".toRegex()
println(projectDir)
val languages = fileTree("$projectDir/src/main/res/")
.matching {
include("**/strings.xml")
}
.filterNot {
it.readText().contains(emptyResourcesElement)
}
.map { it.parentFile.name }
.sorted()
.joinToString(separator = "\n") {
val language = it
.replace(valuesPrefix, "")
.replace("-r", "-")
.takeIf(String::isNotBlank) ?: "en"
" <locale android:name=\"$language\"/>"
}
val content = """
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
$languages
</locale-config>
""".trimIndent()
val localeFile = file("$projectDir/src/main/res/xml/locales_config.xml")
localeFile.parentFile.mkdirs()
localeFile.writeText(content)
}
}
}