Hello,
The following task is always up-to-date and does not create a new zip file. What is wrong with it and what do I have to change
task createZip (type: Zip) {
logger.info "archive database.zip"
from temporaryDir
baseName "database_${project.name}"
doFirst {
FileCollection collect = fileTree(dir:'database')
File versiondir = new File(temporaryDir, "sql" + File.separator + "system" + File.separator + datum);
if (collect.isEmpty()) {
logger.error 'No Files'
}
Set set = new HashSet()
boolean error = false
collect.each {File file ->
if(file.isFile() && file.getName().endsWith(".mac")) {
String absPath = file.getAbsolutePath()
String rootPath = file.getParentFile().getParentFile().getParent()
String pruefString = absPath.substring(rootPath.length(), absPath.length())
if(! set.add(pruefString)) {
logger.error 'duplicate SQL:\t' + file.getAbsolutePath()
error = true
}
if(!error) {
copy {
from file.getParentFile()
into new File (temporaryDir, 'macs/' )
}
}
}
}
if(error) {
throw new GradleException('duplicate Files ')
}
//doFirst-End
}
doLast {
temporaryDir.deleteDir()
}
}