From 0def9a04f22612e22abdc82026123631ff5da948 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 10 Jan 2022 02:00:53 +0530 Subject: Delete empty values directories in Crowdin cleanup (#1656) --- .../src/main/kotlin/crowdin/CrowdinPlugin.kt | 13 +++++++++---- 1 file 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 { 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 { } } } + valuesDirectories.forEach { dir -> + if (dir.listFiles().isNullOrEmpty()) { + dir.delete() + } + } } } } -- cgit v1.2.3