diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-01-10 02:00:53 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-09 20:30:53 +0000 |
commit | 0def9a04f22612e22abdc82026123631ff5da948 (patch) | |
tree | eb9cce8efc3f75444defb6a9cc4fb089f66b804b /build-logic/automation-plugins/src | |
parent | cfceb38ee72896dad3701dcf3f12d8480166e009 (diff) |
Delete empty values directories in Crowdin cleanup (#1656)
Diffstat (limited to 'build-logic/automation-plugins/src')
-rw-r--r-- | build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt | 13 |
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() + } + } } } } |