put forceDelete() function to common build scripts, use it in IDEA build script

This commit is contained in:
Dmitry Jemerov
2011-11-02 17:29:03 +01:00
parent 48a99b477f
commit 9262308032
2 changed files with 24 additions and 1 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ target(compile: "Compile project") {
loadProject()
project.stage("Cleaning up sandbox folder")
ant.delete(dir: paths.sandbox)
forceDelete(paths.sandbox)
[paths.sandbox, paths.distWin, paths.distAll, paths.distUnix, paths.distMac, paths.artifacts, paths.artifacts_core].each {
ant.mkdir(dir: it)
+23
View File
@@ -195,6 +195,29 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
})
binding.setVariable("forceDelete", { String dirPath ->
// if wasn't deleted - retry several times
attempt = 1
while (attempt < 21 && (new File(dirPath).exists())) {
if (attempt > 1) {
ant.echo "Deleting $dirPath ... (attempt=$attempt)"
// let's wait a bit and try again - may be help
// in some cases on our windows 7 agents
sleep(2000)
}
ant.delete(failonerror: false, dir: dirPath)
attempt++
}
if (new File(dirPath).exists()) {
ant.project.log ("Cannot delete directory: $dirPath" )
System.exit (1)
}
})
binding.setVariable("patchPropertiesFile", { String where ->
ant.echo(file: "$where/bin/idea.properties", append: "true", message:
isEap() ?