You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Peter Reilly <pe...@gmail.com> on 2008/03/14 12:17:21 UTC
Re: Ant script for building Javadoc, is there a way to bundle common tags?
I have a patch for macrodef which allows macrodef to have (nearly)
arbitrary xml
fragments:
<macrodef name="thecommonlinks">
<sequential>
<!-- This part is very common : Start -->
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
packagelistLoc="javadoc/j2se-1.5.0"/>
<link offline="true" href="http://java.sun.com/javaee/5/docs/api/"
packagelistLoc="javadoc/javaee-5"/>
<link href="http://lab.ourserver.com/javadoc/common/"/>
<link href="http://lab.ourserver.com/javadoc/dist/"/>
<link href="http://lab.ourserver.com/javadoc/ejb/"/>
<link href="http://lab.ourserver.com/javadoc/web/"/>
</sequential>
</macrodef>
<javadoc destdir="${javadoc.dir}/common"
classpathref="path.combined"
windowtitle="SOM Common API Doc"
encoding="UTF-8"
charset="UTF-8"
access="private">
<thecommonlinks/>
<fileset dir="${somCommon.dir}/src">
<include name="**/*.java"/>
</fileset>
</javadoc>
(https://issues.apache.org/bugzilla/show_bug.cgi?id=40678)
I have some issues with it - namely the reporting of errors - the code
currently cannot see the full ant script stack trace to report errors.
In the meantime, you should use <presetdef>
<presetdef name="myjavadoc">
<javadoc
encoding="UTF-8"
charset="UTF-8"
access="private">
<!-- This part is very common : Start -->
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
packagelistLoc="javadoc/j2se-1.5.0"/>
<link offline="true" href="http://java.sun.com/javaee/5/docs/api/"
packagelistLoc="javadoc/javaee-5"/>
<link href="http://lab.ourserver.com/javadoc/common/"/>
<link href="http://lab.ourserver.com/javadoc/dist/"/>
<link href="http://lab.ourserver.com/javadoc/ejb/"/>
<link href="http://lab.ourserver.com/javadoc/web/"/>
<link href="http://lab.ourserver.com/javadoc/downloadClient/"/>
<!-- This part is very common : End -->
</javadoc>
</presetdef>
<myjavadoc
destdir="${javadoc.dir}/common"
classpathref="path.combined"
windowtitle="SOM Common API Doc">
<fileset dir="${somCommon.dir}/src">
<include name="**/*.java"/>
</fileset>
</myjavadoc>
Peter
On Fri, Mar 14, 2008 at 10:28 AM, Kent Larsson <Ke...@tpb.se> wrote:
> Hi,
>
> In our Ant script to build Javadoc we have lots of <link ...>'s inside
> our <javadoc ...>'s where the <link ...>'s are duplicated into most of
> our <javadoc ...>'s. We would like to reference these so we don't have
> the same lines of code in lots of places in the build script. We have
> tried googling and reading the Ant and Javadoc manuals without success.
>
> /* Start of example Javadoc Ant snippet */
> <javadoc destdir="${javadoc.dir}/common"
> classpathref="path.combined"
> windowtitle="SOM Common API Doc"
> encoding="UTF-8"
> charset="UTF-8"
> access="private">
> <!-- This part is very common : Start -->
> <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
> packagelistLoc="javadoc/j2se-1.5.0"/>
> <link offline="true" href="http://java.sun.com/javaee/5/docs/api/"
> packagelistLoc="javadoc/javaee-5"/>
> <link href="http://lab.ourserver.com/javadoc/common/"/>
> <link href="http://lab.ourserver.com/javadoc/dist/"/>
> <link href="http://lab.ourserver.com/javadoc/ejb/"/>
> <link href="http://lab.ourserver.com/javadoc/web/"/>
> <link href="http://lab.ourserver.com/javadoc/downloadClient/"/>
> <!-- This part is very common : End -->
> <fileset dir="${somCommon.dir}/src">
> <include name="**/*.java"/>
> </fileset>
> </javadoc>
> /* End of example Javadoc Ant snippet */
>
> Is there a way to bundle the links so they may be referenced? Something
> similar to:
>
> /* Start of example pseudo-code Javadoc Ant snippet */
> <linkbundle name="thecommonlinks">
> <!-- This part is very common : Start -->
> <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
> packagelistLoc="javadoc/j2se-1.5.0"/>
> <link offline="true" href="http://java.sun.com/javaee/5/docs/api/"
> packagelistLoc="javadoc/javaee-5"/>
> <link href="http://lab.ourserver.com/javadoc/common/"/>
> <link href="http://lab.ourserver.com/javadoc/dist/"/>
> <link href="http://lab.ourserver.com/javadoc/ejb/"/>
> <link href="http://lab.ourserver.com/javadoc/web/"/>
> <!-- This part is very common : End -->
> </linkbudle>
>
> <javadoc destdir="${javadoc.dir}/common"
> classpathref="path.combined"
> windowtitle="SOM Common API Doc"
> encoding="UTF-8"
> charset="UTF-8"
> access="private">
> <linkbudlereference name="thecommonlinks"/>
> <fileset dir="${somCommon.dir}/src">
> <include name="**/*.java"/>
> </fileset>
> </javadoc>
> /* End of example pseudo-code Javadoc Ant snippet */
>
> As we have 7-8 <javadoc> tags (to build individual javadocs when we
> don't want to build them all) it would be nice and clean to reference
> common <link> tags in some way.
>
> Thanks for reading!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Ant script for building Javadoc, is there a way to bundle common tags?
Posted by Dominique Devienne <dd...@gmail.com>.
On Fri, Mar 14, 2008 at 6:17 AM, Peter Reilly
<pe...@gmail.com> wrote:
> I have a patch for macrodef which allows macrodef to have (nearly)
> arbitrary xml fragments:
>
> <macrodef name="thecommonlinks">
> <sequential>
> <!-- This part is very common : Start -->
> <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
> packagelistLoc="javadoc/j2se-1.5.0"/>
> <link offline="true" href="http://java.sun.com/javaee/5/docs/api/"
> packagelistLoc="javadoc/javaee-5"/>
> <link href="http://lab.ourserver.com/javadoc/common/"/>
> <link href="http://lab.ourserver.com/javadoc/dist/"/>
> <link href="http://lab.ourserver.com/javadoc/ejb/"/>
> <link href="http://lab.ourserver.com/javadoc/web/"/>
> </sequential>
> </macrodef>
This is great Peter, except for the name maybe. Would it be possible
to keep <macrodef> for tasks and have a separate <fragmentdef> for XML
fragments to be used inside tasks or types? <fragmentdef> then can get
rid of the nested <sequential> and doesn't accept <attribute> and
<element>?!?!
Also, if the fragment contains ${prop} and @{prop}, which context is
used to replace these (if at all), the declaration point or the use
point? --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org