|
@@ -140,6 +140,14 @@ public class Zip extends MatchingTask { |
|
|
*/ |
|
|
*/ |
|
|
private String encoding; |
|
|
private String encoding; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Whether the original compression of entries coming from a ZIP |
|
|
|
|
|
* archive should be kept (for example when updating an archive). |
|
|
|
|
|
* |
|
|
|
|
|
* @since Ant 1.6 |
|
|
|
|
|
*/ |
|
|
|
|
|
private boolean keepCompression = false; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* This is the name/location of where to |
|
|
* This is the name/location of where to |
|
|
* create the .zip file. |
|
|
* create the .zip file. |
|
@@ -307,6 +315,16 @@ public class Zip extends MatchingTask { |
|
|
return encoding; |
|
|
return encoding; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Whether the original compression of entries coming from a ZIP |
|
|
|
|
|
* archive should be kept (for example when updating an archive). |
|
|
|
|
|
* |
|
|
|
|
|
* @since Ant 1.6 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void setKeepCompression(boolean keep) { |
|
|
|
|
|
keepCompression = keep; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* validate and build |
|
|
* validate and build |
|
|
*/ |
|
|
*/ |
|
@@ -631,11 +649,20 @@ public class Zip extends MatchingTask { |
|
|
zipFile(f, zOut, prefix + name, fileMode); |
|
|
zipFile(f, zOut, prefix + name, fileMode); |
|
|
} else if (!resources[i].isDirectory()) { |
|
|
} else if (!resources[i].isDirectory()) { |
|
|
ZipEntry ze = zf.getEntry(resources[i].getName()); |
|
|
ZipEntry ze = zf.getEntry(resources[i].getName()); |
|
|
|
|
|
|
|
|
if (ze != null) { |
|
|
if (ze != null) { |
|
|
zipFile(zf.getInputStream(ze), zOut, prefix + name, |
|
|
|
|
|
ze.getTime(), zfs.getSrc(getProject()), |
|
|
|
|
|
zfs.hasFileModeBeenSet() ? fileMode |
|
|
|
|
|
: ze.getUnixMode()); |
|
|
|
|
|
|
|
|
boolean oldCompress = doCompress; |
|
|
|
|
|
if (keepCompression) { |
|
|
|
|
|
doCompress = (ze.getMethod() == ZipEntry.DEFLATED); |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
zipFile(zf.getInputStream(ze), zOut, prefix + name, |
|
|
|
|
|
ze.getTime(), zfs.getSrc(getProject()), |
|
|
|
|
|
zfs.hasFileModeBeenSet() ? fileMode |
|
|
|
|
|
: ze.getUnixMode()); |
|
|
|
|
|
} finally { |
|
|
|
|
|
doCompress = oldCompress; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -973,6 +1000,7 @@ public class Zip extends MatchingTask { |
|
|
if (!skipWriting) { |
|
|
if (!skipWriting) { |
|
|
ZipEntry ze = new ZipEntry(vPath); |
|
|
ZipEntry ze = new ZipEntry(vPath); |
|
|
ze.setTime(lastModified); |
|
|
ze.setTime(lastModified); |
|
|
|
|
|
ze.setMethod(doCompress ? ZipEntry.DEFLATED : ZipEntry.STORED); |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* ZipOutputStream.putNextEntry expects the ZipEntry to |
|
|
* ZipOutputStream.putNextEntry expects the ZipEntry to |
|
|