1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2025-12-16 01:01:11 +01:00
This commit is contained in:
Gregor Santner 2018-03-05 17:22:06 +01:00
parent 07acb6bd02
commit d3a2c20515
No known key found for this signature in database
GPG key ID: 7E83A7834AECB009
4 changed files with 39 additions and 1 deletions

View file

@ -47,12 +47,42 @@ allprojects {
tasks.matching { task -> task.name.matches('.*generate.*Resources') }.all {
task -> task.dependsOn copyRepoFiles
}
tasks.matching { task -> task.name.matches('.*generate.*Resources') }.all {
task -> task.doLast { markUntranslatableBuildFields() }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
def markUntranslatableBuildFields() {
Set<Project> proc_projects = new HashSet<>(subprojects)
proc_projects.add(rootProject)
proc_projects.each { proc_project ->
File mergeDir = new File("${proc_project.buildDir}/intermediates/res/merged")
if (!mergeDir.exists()) return
mergeDir.eachDir { dir ->
println("Resources" + dir)
dir.eachFileRecurse { file ->
if (file.name.endsWith(".xml")) {
println(file)
String content = file.getText('UTF-8')
if (content != null && content.contains('<string name="bc_notr__')) {
println("Replacing app name in " + file)
content = content.replace('<string name="bc_notr__', '<string translatable="false" name="bc_notr__')
file.write(content, 'UTF-8')
}
}
}
}
}
}
final String[] ROOT_TO_RAW_COPYFILES = ["README.md", "CHANGELOG.md", "CONTRIBUTORS.md", "LICENSE.txt", "LICENSE.md", "LICENSE"]
task copyRepoFiles(type: Copy) {
from rootProject.files(ROOT_TO_RAW_COPYFILES)