Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 92944 invoked from network); 6 Apr 2006 18:27:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Apr 2006 18:27:59 -0000 Received: (qmail 97915 invoked by uid 500); 6 Apr 2006 18:27:57 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 97859 invoked by uid 500); 6 Apr 2006 18:27:56 -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 97848 invoked by uid 500); 6 Apr 2006 18:27:56 -0000 Received: (qmail 97845 invoked by uid 99); 6 Apr 2006 18:27:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Apr 2006 11:27:56 -0700 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, 06 Apr 2006 11:27:55 -0700 Received: (qmail 92606 invoked by uid 65534); 6 Apr 2006 18:27:35 -0000 Message-ID: <20060406182735.92604.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r392027 - in /ant/core/trunk: docs/manual/CoreTasks/javadoc.html src/etc/testcases/taskdefs/javadoc/javadoc.xml src/main/org/apache/tools/ant/taskdefs/Javadoc.java src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java Date: Thu, 06 Apr 2006 18:27:34 -0000 To: ant-cvs@apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: bodewig Date: Thu Apr 6 11:27:32 2006 New Revision: 392027 URL: http://svn.apache.org/viewcvs?rev=392027&view=rev Log: allow ressource collections for source files in Modified: ant/core/trunk/docs/manual/CoreTasks/javadoc.html ant/core/trunk/src/etc/testcases/taskdefs/javadoc/javadoc.xml ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java Modified: ant/core/trunk/docs/manual/CoreTasks/javadoc.html URL: http://svn.apache.org/viewcvs/ant/core/trunk/docs/manual/CoreTasks/javadoc.html?rev=392027&r1=392026&r2=392027&view=diff ============================================================================== --- ant/core/trunk/docs/manual/CoreTasks/javadoc.html (original) +++ ant/core/trunk/docs/manual/CoreTasks/javadoc.html Thu Apr 6 11:27:32 2006 @@ -484,7 +484,7 @@

A FileSet. All matched files will be passed to javadoc as source files. Ant will automatically add the include pattern **/*.java (and -**/package.html if inncludenosourcepackages is true) to +**/package.html if includenosourcepackages is true) to these filesets.

Nested filesets can be used to document sources that are in the @@ -496,6 +496,14 @@

The packagenames, excludepackagenames and defaultexcludes attributes of the task have no effect on the nested <fileset> elements.

+ +

sourcefiles

+ +

A container for arbitrary file system based resource +collections. All files contained in any of the nested collections +(this includes nested filesets, filelists or paths) will be passed to +javadoc as source files.

package

Same as one entry in the list given by packagenames.

Modified: ant/core/trunk/src/etc/testcases/taskdefs/javadoc/javadoc.xml URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/taskdefs/javadoc/javadoc.xml?rev=392027&r1=392026&r2=392027&view=diff ============================================================================== --- ant/core/trunk/src/etc/testcases/taskdefs/javadoc/javadoc.xml (original) +++ ant/core/trunk/src/etc/testcases/taskdefs/javadoc/javadoc.xml Thu Apr 6 11:27:32 2006 @@ -56,6 +56,28 @@
+ + + + + + + + + + + + + + + + + + + + + + Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=392027&r1=392026&r2=392027&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Thu Apr 6 11:27:32 2006 @@ -25,7 +25,9 @@ import java.io.FileReader; import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.Enumeration; +import java.util.Iterator; import java.util.Locale; import java.util.StringTokenizer; import java.util.Vector; @@ -41,6 +43,8 @@ import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.PatternSet; import org.apache.tools.ant.types.Reference; +import org.apache.tools.ant.types.ResourceCollection; +import org.apache.tools.ant.types.resources.FileResource; import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.JavaEnvUtils; @@ -344,6 +348,23 @@ } } + /** + * Holds a collection of ResourceCollections. + * + *

A separate kind of container is needed since this task + * contains special handling for FileSets that has to occur at + * task runtime.

+ */ + public class ResourceCollectionContainer { + private ArrayList rcs = new ArrayList(); + public void add(ResourceCollection rc) { + rcs.add(rc); + } + private Iterator iterator() { + return rcs.iterator(); + } + } + private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); /** The command line built to execute Javadoc. */ @@ -412,7 +433,8 @@ private boolean old = false; private String executable = null; - private Vector fileSets = new Vector(); + private ResourceCollectionContainer nestedSourceFiles + = new ResourceCollectionContainer(); private Vector packageSets = new Vector(); /** @@ -1514,7 +1536,17 @@ * @since 1.5 */ public void addFileset(FileSet fs) { - fileSets.addElement(fs); + createSourceFiles().add(fs); + } + + /** + * Adds a container for resource collections. + * + *

All included files will be added as sourcefiles.

+ * @since 1.7 + */ + public ResourceCollectionContainer createSourceFiles() { + return nestedSourceFiles; } /** @@ -1594,7 +1626,7 @@ } Vector sourceFilesToDoc = (Vector) sourceFiles.clone(); - addFileSets(sourceFilesToDoc); + addSourceFiles(sourceFilesToDoc); if (packageList == null && packagesToDoc.size() == 0 && sourceFilesToDoc.size() == 0) { @@ -2036,15 +2068,21 @@ } /** - * Add the files matched by the nested filesets to the Vector as - * SourceFile instances. + * Add the files matched by the nested source files to the Vector + * as SourceFile instances. * - * @since 1.5 + * @since 1.7 */ - private void addFileSets(Vector sf) { - Enumeration e = fileSets.elements(); - while (e.hasMoreElements()) { - FileSet fs = (FileSet) e.nextElement(); + private void addSourceFiles(Vector sf) { + Iterator e = nestedSourceFiles.iterator(); + while (e.hasNext()) { + ResourceCollection rc = (ResourceCollection) e.next(); + if (!rc.isFilesystemOnly()) { + throw new BuildException("only file system based resources are" + + " supported by javadoc"); + } + if (rc instanceof FileSet) { + FileSet fs = (FileSet) rc; if (!fs.hasPatterns() && !fs.hasSelectors()) { fs = (FileSet) fs.clone(); fs.createInclude().setName("**/*.java"); @@ -2052,11 +2090,11 @@ fs.createInclude().setName("**/package.html"); } } - File baseDir = fs.getDir(getProject()); - DirectoryScanner ds = fs.getDirectoryScanner(getProject()); - String[] files = ds.getIncludedFiles(); - for (int i = 0; i < files.length; i++) { - sf.addElement(new SourceFile(new File(baseDir, files[i]))); + } + Iterator iter = rc.iterator(); + while (iter.hasNext()) { + sf.addElement(new SourceFile(((FileResource) iter.next()) + .getFile())); } } } Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java?rev=392027&r1=392026&r2=392027&view=diff ============================================================================== --- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java (original) +++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java Thu Apr 6 11:27:32 2006 @@ -118,4 +118,16 @@ public void testNestedFilesetRefInPath() throws Exception { executeTarget("nestedFilesetRefInPath"); } + + public void testNestedFilesetNoPatterns() throws Exception { + executeTarget("nestedFilesetNoPatterns"); + } + + public void testDoublyNestedFileset() throws Exception { + executeTarget("doublyNestedFileset"); + } + + public void testDoublyNestedFilesetNoPatterns() throws Exception { + executeTarget("doublyNestedFilesetNoPatterns"); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org