aboutsummaryrefslogtreecommitdiff
path: root/build-logic/automation-plugins/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'build-logic/automation-plugins/src/main')
-rw-r--r--build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt13
1 files changed, 9 insertions, 4 deletions
diff --git a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt b/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt
index f80d2ad4..dc67c51b 100644
--- a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt
+++ b/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt
@@ -84,10 +84,10 @@ class CrowdinDownloadPlugin : Plugin<Project> {
doLast {
val sourceSets = arrayOf("main", "nonFree")
for (sourceSet in sourceSets) {
- val stringFiles =
- File("${projectDir}/src/$sourceSet").walkTopDown().filter {
- it.name == "strings.xml"
- }
+ val fileTreeWalk = projectDir.resolve("src/$sourceSet").walkTopDown()
+ val valuesDirectories =
+ fileTreeWalk.filter { it.isDirectory }.filter { it.name.startsWith("values") }
+ val stringFiles = fileTreeWalk.filter { it.name == "strings.xml" }
val sourceFile =
stringFiles.firstOrNull { it.path.endsWith("values/strings.xml") }
?: throw GradleException("No root strings.xml found in '$sourceSet' sourceSet")
@@ -103,6 +103,11 @@ class CrowdinDownloadPlugin : Plugin<Project> {
}
}
}
+ valuesDirectories.forEach { dir ->
+ if (dir.listFiles().isNullOrEmpty()) {
+ dir.delete()
+ }
+ }
}
}
}