Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 93813 invoked from network); 27 Feb 2002 09:00:26 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 27 Feb 2002 09:00:26 -0000 Received: (qmail 11499 invoked by uid 97); 27 Feb 2002 09:00:35 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 11444 invoked by uid 97); 27 Feb 2002 09:00:34 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 11433 invoked by uid 97); 27 Feb 2002 09:00:34 -0000 Date: 27 Feb 2002 09:00:19 -0000 Message-ID: <20020227090019.14107.qmail@icarus.apache.org> From: stevel@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Pack.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N stevel 02/02/27 01:00:18 Modified: src/etc/testcases/taskdefs gzip.xml src/testcases/org/apache/tools/ant/taskdefs GzipTest.java src/main/org/apache/tools/ant/taskdefs Pack.java Log: time checking on gzip, with tests. submitted by Jeff Martin Revision Changes Path 1.6 +5 -0 jakarta-ant/src/etc/testcases/taskdefs/gzip.xml Index: gzip.xml =================================================================== RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/gzip.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- gzip.xml 19 Nov 2001 15:53:14 -0000 1.5 +++ gzip.xml 27 Feb 2002 09:00:18 -0000 1.6 @@ -22,6 +22,11 @@ + + + + + 1.7 +21 -0 jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/GzipTest.java Index: GzipTest.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/GzipTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- GzipTest.java 10 Jan 2002 10:13:12 -0000 1.6 +++ GzipTest.java 27 Feb 2002 09:00:18 -0000 1.7 @@ -86,4 +86,25 @@ expectBuildException("test4", "attribute zipfile invalid"); } + public void testGZip(){ + executeTarget("realTest"); + String log = getLog(); + assertTrue("Expecting message starting with 'Building:' but got '" + + log + "'", log.startsWith("Building:")); + assertTrue("Expecting message ending with 'asf-logo.gif.gz' but got '" + + log + "'", log.endsWith("asf-logo.gif.gz")); + } + + public void testDateCheck(){ + executeTarget("testDateCheck"); + String log = getLog(); + assertTrue( + "Expecting message ending with 'asf-logo.gif.gz is up to date.' but got '" + log + "'", + log.endsWith("asf-logo.gif.gz is up to date.")); + } + + public void tearDown(){ + executeTarget("cleanup"); + } + } 1.3 +10 -4 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Pack.java Index: Pack.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Pack.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Pack.java 10 Jan 2002 13:59:31 -0000 1.2 +++ Pack.java 27 Feb 2002 09:00:18 -0000 1.3 @@ -83,11 +83,11 @@ } private void validate() { - if (zipFile == null) { + if (zipFile == null || zipFile.getName().equals("")) { throw new BuildException("zipfile attribute is required", location); } - if (source == null) { + if (source == null || source.getName().equals("")) { throw new BuildException("src attribute is required", location); } @@ -99,8 +99,14 @@ public void execute() throws BuildException { validate(); - log("Building: " + zipFile.getAbsolutePath()); - pack(); + + if(zipFile.lastModified() < source.lastModified()){ + log("Building: " + zipFile.getAbsolutePath()); + pack(); + }else{ + log("Nothing to do: " + zipFile.getAbsolutePath() + + " is up to date."); + } } private void zipFile(InputStream in, OutputStream zOut) -- To unsubscribe, e-mail: For additional commands, e-mail: