Hi,
I want to extract a self extracting zip file (after extraction I modify some files and repackage it as zip file to distribute it).
The file to extract is the following:
eclipse-inst-win64.exe
The copy task (which unzips the file) always mention “UP-TO-DATE” so I investigated why the task does not extract anything.
For further documentation here the task-configuration:
tasks.create(name: extractTask, type: Copy) {
def inputFile = new File(buildDir, inst.srcName)
if(inst.srcName.endsWith('.exe')) {
ext.srcTree = zipTree(inputFile)
} else {
ext.srcTree = tarTree(inputFile)
}
from srcTree
into workingDir
}
I checked the Class “ZipFileTree” in gradles github repo and tried to extract the ZipEntries as coded in this class.
With the ZipFile/ZipEntry of the imported Classes from Ant (org.apache.tools.zip.) the ZipEntries could not be loaded!
The same classes (java.util.zip.) from JDK works like a charm.
At the moment I don’t know if it is a bug in the Ant-Implementation of the classes or if it is a bug in ZipFileTree.
I don’t know the architecture of FileTree and ZipFileTree in detail but a simple solution from my point of view would be to replace the Ant-Classes with the JDK-Classes.
At the moment I also have no save workaround (under linux/osx I simply will use an exec-Task to execute unzip, on a windows system this will not work out of the box since unzip is not on path by default)