gradle: sort lines in localeConfig

This works around https://issuetracker.google.com/issues/281825213

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2023-05-12 15:55:31 +02:00
parent 6a72194106
commit 9972d9607e

View File

@ -2,6 +2,7 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.android.build.gradle.tasks.GenerateLocaleConfigTask
// Grotesque workaround for https://issuetracker.google.com/issues/279780940 // Grotesque workaround for https://issuetracker.google.com/issues/279780940
System.setProperty("com.android.tools.r8.disableApiModeling", "1") System.setProperty("com.android.tools.r8.disableApiModeling", "1")
@ -94,3 +95,14 @@ tasks.withType<JavaCompile>().configureEach {
tasks.withType<KotlinCompile>().configureEach { tasks.withType<KotlinCompile>().configureEach {
compilerOptions.jvmTarget.set(JvmTarget.JVM_17) compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
} }
// Grotesque workaround for https://issuetracker.google.com/issues/281825213
tasks.withType<GenerateLocaleConfigTask>().configureEach {
doLast {
localeConfig.asFileTree.files.forEach {
val lines = it.readLines()
val newLines = lines.subList(0, 2) + lines.subList(2, lines.size - 1).sorted() + lines.last()
it.writeText(newLines.joinToString(separator = "\n"))
}
}
}