From e0ad7527a06eb0e9513160b0c5b49bc9f8ab5f5b Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Sun, 13 Feb 2000 21:43:34 +0000 Subject: [PATCH] don't rebuild zip/jar files if they are up to date already git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267605 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Zip.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index 98b00cc4a..3fb60a872 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -92,8 +92,6 @@ public class Zip extends MatchingTask { } public void execute() throws BuildException { - project.log("Building "+ archiveType +": "+ zipFile.getAbsolutePath()); - if (baseDir == null) { throw new BuildException("basedir attribute must be set!"); } @@ -106,6 +104,16 @@ public class Zip extends MatchingTask { String[] files = ds.getIncludedFiles(); String[] dirs = ds.getIncludedDirectories(); + // quick exit if the target is up to date + boolean upToDate = true; + for (int i=0; i + zipFile.lastModified()) + upToDate = false; + if (upToDate) return; + + project.log("Building "+ archiveType +": "+ zipFile.getAbsolutePath()); + try { ZipOutputStream zOut = new ZipOutputStream(new FileOutputStream(zipFile)); initZipOutputStream(zOut);