Question…
I have a copy task, which is unzipping and copying an archive dependency (which gradle was nice enough to download!).
task explodeDependencies(type: Copy, dependsOn: configurations.nativesdk) {
configurations.nativesdk.filter { it.toString().endsWith('.zip') }.each {
from (zipTree(it))
}
into "${rootProject.getProjectDir()}/sdks"
}
What is the cleanest way to delete the ‘buildDir/tmp’ directory which is produced by the ‘zipTree()’ method?
Is there any way to do this without causing the ‘explodeDependencies’ task to unzip the archives again? I tested deleting this directory, after the ‘explodeDependencies’ task completed. The task has to unzip the archives again, in order to determine that the inputs haven’t changed.
Some background…
I’m migrating our old build to use Jenkins + Git + Gradle + Artifactory (which is awesome compared to our old process…let me just say). So, my gradle build is trying to wrap the old build commands.
However, our old build can’t really be considered incremental. Therefore, I require a git clean at the very beginning of the process. Either that, or I have to re-clone, which would be even more painful.
Therefore, I’m using the Jenkins Git plugin’s “clean” feature, which occurs before I can run any build task. The command “git clean -xdf” fails, due to a MAX_PATH issue in msysgit (e.g. only on windows). This comes from the previous gradle task, run in the previous build workspace, which produces a really long path for extracting the archive, in the temp directory.