Delete empty values directories in Crowdin cleanup (#1656)
This commit is contained in:
parent
cfceb38ee7
commit
0def9a04f2
1 changed files with 9 additions and 4 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue