Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 46620 invoked from network); 20 Oct 2005 21:25:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Oct 2005 21:25:14 -0000 Received: (qmail 37332 invoked by uid 500); 20 Oct 2005 21:25:13 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 37269 invoked by uid 500); 20 Oct 2005 21:25:12 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 37257 invoked by uid 500); 20 Oct 2005 21:25:12 -0000 Received: (qmail 37252 invoked by uid 99); 20 Oct 2005 21:25:12 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 20 Oct 2005 14:25:11 -0700 Received: (qmail 46489 invoked by uid 65534); 20 Oct 2005 21:24:51 -0000 Message-ID: <20051020212451.46486.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r327004 - /ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java Date: Thu, 20 Oct 2005 21:24:51 -0000 To: ant-cvs@apache.org From: antoine@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: antoine Date: Thu Oct 20 14:24:45 2005 New Revision: 327004 URL: http://svn.apache.org/viewcvs?rev=327004&view=rev Log: instantiate a FileResource when setSrc(Resource) is called. Otherwise a number of tests break. Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java?rev=327004&r1=327003&r2=327004&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java Thu Oct 20 14:24:45 2005 @@ -21,6 +21,7 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; +import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.types.resources.FileResource; import org.apache.tools.zip.UnixStat; @@ -61,6 +62,7 @@ private boolean fileModeHasBeenSet = false; private boolean dirModeHasBeenSet = false; + private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); /** Constructor for ArchiveFileSet */ public ArchiveFileSet() { @@ -134,14 +136,18 @@ * Set the source Archive file for the archivefileset. Prevents both * "dir" and "src" from being specified. * - * @param srcFile The archive from which to extract entries. + * @param src The archive from which to extract entries. */ public void setSrcResource(Resource src) { checkAttributesAllowed(); if (hasDir) { throw new BuildException("Cannot set both dir and src attributes"); } - this.src = src; + if (getProject()!=null) { + this.src = new FileResource(FILE_UTILS.resolveFile(getProject().getBaseDir(),src.toString())); + } else { + this.src = new FileResource(new File(src.toString())); + } } /** @@ -417,8 +423,7 @@ /** * A ArchiveFileset accepts another ArchiveFileSet or a FileSet as reference * FileSets are often used by the war task for the lib attribute - * @param p the project to use - * @return the abstract fileset instance + * @param zfs the project to use */ protected void configureFileSet(ArchiveFileSet zfs) { zfs.setPrefix(prefix); @@ -440,6 +445,22 @@ return ((ArchiveFileSet) getRef(getProject())).clone(); } else { return super.clone(); + } + } + + /** + * for file based zipfilesets, return the same as for normal filesets + * else just return the path of the zip + * @return for file based archivefilesets, included files as a list + * of semicolon-separated filenames. else just the name of the zip. + */ + public String toString() { + if (hasDir && getProject() != null) { + return super.toString(); + } else if (src != null) { + return src.getName(); + } else { + return null; } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org