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 {
|
doLast {
|
||||||
val sourceSets = arrayOf("main", "nonFree")
|
val sourceSets = arrayOf("main", "nonFree")
|
||||||
for (sourceSet in sourceSets) {
|
for (sourceSet in sourceSets) {
|
||||||
val stringFiles =
|
val fileTreeWalk = projectDir.resolve("src/$sourceSet").walkTopDown()
|
||||||
File("${projectDir}/src/$sourceSet").walkTopDown().filter {
|
val valuesDirectories =
|
||||||
it.name == "strings.xml"
|
fileTreeWalk.filter { it.isDirectory }.filter { it.name.startsWith("values") }
|
||||||
}
|
val stringFiles = fileTreeWalk.filter { it.name == "strings.xml" }
|
||||||
val sourceFile =
|
val sourceFile =
|
||||||
stringFiles.firstOrNull { it.path.endsWith("values/strings.xml") }
|
stringFiles.firstOrNull { it.path.endsWith("values/strings.xml") }
|
||||||
?: throw GradleException("No root strings.xml found in '$sourceSet' sourceSet")
|
?: 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