Return-Path: Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Delivered-To: mailing list dev@ant.apache.org Received: (qmail 51934 invoked by uid 500); 19 Mar 2003 10:48:02 -0000 Received: (qmail 51931 invoked from network); 19 Mar 2003 10:48:02 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 19 Mar 2003 10:48:02 -0000 Received: (qmail 13745 invoked by uid 1146); 19 Mar 2003 10:48:01 -0000 Date: 19 Mar 2003 10:48:01 -0000 Message-ID: <20030319104801.13744.qmail@icarus.apache.org> From: bodewig@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional Cab.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N bodewig 2003/03/19 02:48:01 Modified: . WHATSNEW docs/manual/OptionalTasks cab.html src/main/org/apache/tools/ant/taskdefs/optional Cab.java Log: Make 's basedir optional. PR: 18046 Revision Changes Path 1.368 +3 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.367 retrieving revision 1.368 diff -u -r1.367 -r1.368 --- WHATSNEW 19 Mar 2003 10:09:38 -0000 1.367 +++ WHATSNEW 19 Mar 2003 10:48:01 -0000 1.368 @@ -169,6 +169,9 @@ * Support for HP's NonStop (Tandem) OS has been added. +* 's basedir attribute is now optional if you specify nested + filesets. Bugzilla Report 18046. + Changes from Ant 1.5.2 to Ant 1.5.3 =================================== 1.8 +22 -2 ant/docs/manual/OptionalTasks/cab.html Index: cab.html =================================================================== RCS file: /home/cvs/ant/docs/manual/OptionalTasks/cab.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- cab.html 22 Jun 2002 23:38:28 -0000 1.7 +++ cab.html 19 Mar 2003 10:48:01 -0000 1.8 @@ -39,7 +39,7 @@ basedir the directory to start archiving files from. - Yes + No verbose @@ -91,6 +91,13 @@ No +

Parameters specified as nested elements

+

fileset

+ +

The cab task supports any number of nested <fileset> +elements to specify the files to be included in the archive.

+

Examples

   <cab cabfile="${dist}/manual.cab"
  @@ -121,8 +128,21 @@
   directory api are archived, and files with the name todo.html are
   excluded. Output from the cabarc tool is displayed in the build
   output.

+ +
  +<cab cabfile="${dist}/manual.cab"
  +     verbose="yes">
  +  <fileset
  +       dir="htdocs/manual"
  +       includes="api/**/*.html"
  +       excludes="**/todo.html"
  +  />
  +</cab>
  +
+

is equivalent to the example above.

+
-

Copyright © 2000-2002 Apache Software Foundation. All rights +

Copyright © 2000-2003 Apache Software Foundation. All rights Reserved.

1.25 +20 -15 ant/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java Index: Cab.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- Cab.java 10 Feb 2003 14:13:45 -0000 1.24 +++ Cab.java 19 Mar 2003 10:48:01 -0000 1.25 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -143,14 +143,17 @@ * for side-effects to me... */ protected void checkConfiguration() throws BuildException { - if (baseDir == null) { - throw new BuildException("basedir attribute must be set!", getLocation()); + if (baseDir == null && filesets.size() == 0) { + throw new BuildException("basedir attribute or at least one " + + "nested filest is required!", + getLocation()); } - if (!baseDir.exists()) { + if (baseDir != null && !baseDir.exists()) { throw new BuildException("basedir does not exist!", getLocation()); } if (cabFile == null) { - throw new BuildException("cabfile attribute must be set!" , getLocation()); + throw new BuildException("cabfile attribute must be set!", + getLocation()); } } @@ -175,7 +178,7 @@ boolean upToDate = true; for (int i = 0; i < files.size() && upToDate; i++) { String file = files.elementAt(i).toString(); - if (new File(baseDir, file).lastModified() > + if (fileUtils.resolveFile(baseDir, file).lastModified() > cabFile.lastModified()) { upToDate = false; } @@ -220,16 +223,16 @@ protected Vector getFileList() throws BuildException { Vector files = new Vector(); - if (filesets.size() == 0) { + if (baseDir != null) { // get files from old methods - includes and nested include appendFiles(files, super.getDirectoryScanner(baseDir)); - } else { - // get files from filesets - for (int i = 0; i < filesets.size(); i++) { - FileSet fs = (FileSet) filesets.elementAt(i); - if (fs != null) { - appendFiles(files, fs.getDirectoryScanner(getProject())); - } + } + + // get files from filesets + for (int i = 0; i < filesets.size(); i++) { + FileSet fs = (FileSet) filesets.elementAt(i); + if (fs != null) { + appendFiles(files, fs.getDirectoryScanner(getProject())); } } @@ -264,7 +267,9 @@ try { Process p = Execute.launch(getProject(), new String[] {"listcab"}, null, - baseDir, true); + baseDir != null ? baseDir + : getProject().getBaseDir(), + true); OutputStream out = p.getOutputStream(); // Create the stream pumpers to forward listcab's stdout and stderr to the log