Hello all,
Here I am yet again with another question about a copy task.
I would like to create a backup of a file whose path is in my gradle.properties file. The file has to be copied to a path which is in the same properties file, with a timestamp added at the end.
For some reason or another, the copy task works perfectly when I simply use self typed paths, but not when I start using the paths from the properties file.
The code snippet I have is as follows:
task backupFiles(type: Copy) {
String backupDestinationDirectory = backup_file_path
backupDestinationDirectory = "'" + backupDestinationDirectory + new Date().format('dd-MM-yyyy-HH.mm.ss') + "/" + "'"
from properties_file
into backupDestinationDirectory
rename { String fileName ->
String extension = ""
... determine extension ...
fileName -= extension
fileName += "-" + new Date().format('dd-MM-yyyy-HH.mm.ss') + extension
return fileName
}
}
This is a wild guess of mine, but does this have something to do with the from and into being set at configuration phase? Or am I completely wrong?
Anyways, I hope someone is able to point me in the right direction.
Thanks!
~ Joe