Summary: | javadoc: don't create packagenames option if filesets are used | ||
---|---|---|---|
Product: | Ant | Reporter: | Jens Elkner <elkner> |
Component: | Core tasks | Assignee: | Ant Notifications List <notifications> |
Status: | NEW --- | ||
Severity: | blocker | ||
Priority: | P2 | ||
Version: | 1.7.1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux |
Description
Jens Elkner
2009-09-05 21:24:13 UTC
see also bug #47196 and the updated documentation in svn revision 786510 sourcepath isn't directly equivalent to -sourcepath, it does more. In fact it implicitly creates nested packagesets for each directory using the packagenames attribute - or "*" if no packagenames have been specified. In your case this leads to the bogus all-classes frame - if you don't specify a sourcepath attribute at all, it should work. is "don't specify the sourcepath attribute at all" good enough to close this? The implementation won't change, we might tweak the documentation, though. Well, for my puposes it would be ok for now. However, having a pkgnames attribute is IMHO the cleaner way to handle special needs and get closer to the javadoc tool. I.e. if pkgnames is set (even if empty), the ant task should not generate pkgnames, otherwise behave in the traditional way. I ran into this issue while attempting to create a javadoc task equivalent to the following javadoc command which generates a couple hundred documentation files (http://code.google.com/p/filewise/source/browse/#svn/trunk/docs/api): javadoc -private -sourcepath /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src -source 1.6 -J-Xmx128m -d docs/api src/com/filewise/*.java src/com/applcore/java/*/*.java As indicated, the following seemingly equivalent task definition "does more" in that it generates several thousand output files including doc for all of the JDK source files (requiring the memory to be increased to -Xmx768m), which takes about 25 minutes: <property name="sdk.java.src" location="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src"/> <!-- that property is actually set differently with <whichresource> depending on whether we're on Mac, Linux or Windows --> <target name="doc" depends="init"> <javadoc access="protected" destdir="docs/api" source="1.6" maxmemory="768m"> <packageset dir="src"/> <sourcepath> <pathelement location="${sdk.java.src}"/> </sourcepath> </javadoc> </target> I tried the "don't specify the sourcepath attribute at all" solution, but then it no longer picks up the inherited comments from the JDK, which makes sense, since there's no longer anything to indicate where the JDK source files are. Thus all of the "Description copied from ..." comments disappeared from the output files. I tried adding "-sourcepath" as an additionalparam, but strangely it thought there was more than one "-sourcepath", until I replaced "<packageset>" with "<fileset>". So the final workaround for properly specifying the "-sourcepath" parameter appears to be: <target name="doc" depends="init"> <javadoc access="protected" destdir="docs/api" source="1.6" maxmemory="768m" additionalparam="-sourcepath ${sdk.java.src}"> <fileset dir="src"> <include name="*.java"/> <include name="**/*.java"/> </fileset> </javadoc> </target> It now generates only 250 files and runs in as little as 128m, or with more memory takes 25 seconds rather than 25 minutes. Rob S. http://Lnkd.com?24 Bug #41292 was a better place to put that. |