AntDoc V0.7e

Status

This tool is not an open-source project so far. However, this does not involve that it is not free of use. At the opposite, feel free to use it and spread it as is.

One reason why the tool is not part of an open-source project is that I would not have time enough to dedicate to the administration.

Acknowlegment

This task is still under development, which means that it is subject to change. However, the task works under certain circumstances that are described in this paragraph.

This task has only been tested under Windows NT V4.0 SP6 and under Windows 2000 SP1. Please, send feedback to notify whether the use of this task was OK under other platforms and configurations!

The exact configuration under which the task has been successfully tested is the following:

  1. Ant V1.4.1: it has not been tested with other versions it also works with later versions, such as Ant V1.5Beta2. However, it does not work with Ant V1.3
  2. Xerces V1.4.3 (Xerces Java 1): it now uses the JAXP API shipped via jaxp.jar with Ant
  3. Xalan V2.3.1 (Xalan Java 2): does not work yet with that transformer
  4. Jakarta Regexp V1.2: this jar is only needed when you specify some filtering on targets (see bellow the filter section for explanation about when AntDoc using regular expressions)
  5. Saxon V6.2.2; the task will not work with version 6.3!
  6. Java plug-in V1.2; the default Internet Explorer JDK is something like 1.1 and it will not work! At the time of this writting, the AntDoc runtime mechanism does not work under Netscape V4.7 (may be a problem with Javascript :-().. You do not need any additional J2SE runtime environment with Netscape V4.7 nor with Internet Explorer, nor with Mozilla V1.1a. Note that the applet is signed so as to overpass Java sandbow model: a jar (.jar) file is for SUN Java Plug-in and the cabinet file (.cab) is for Internet Explorer.

Bugs

A lot of bugs make the project still in beta version. In order to spare some time to the end-user, here are some known bugs, as well as their workaround.

Installation and use

When "$" (dollar symbol) is being used, it means that the appended variable should be considered as an environment variable: $ANT_HOME is to be translated as %ANT_HOME% under Windows and as ${ANT_HOME} under UNIX.

In this section and for the remaining of the page, it assumed that you are familiar with the open-source Jakarta's Ant tool.

In general, when an extra jar is needed it order to make the task work, it means that you should put that jar in the $ANT_HOME/lib directory.

At the moment, in order to use this task, you need to have Saxon XSLT Processor installed (at least its main jar saxon.jar), and to have it copied in the $ANT_HOME/lib directory, where $ANT_HOME stands for the Ant distribution folder. You also need Xerces Java 1 to be installed. Off course, it is also required to place the provided AntDoc Ant task AntDoc.jar byte-code archive file in that same directory.

In the Ant build file script which makes use of this task, first "dynamically load" the task definition before using it.

Description

The aim of this task is to provide a tool that automatically generates HTML documentation from Ant build files. The way this documentation is generated is similar to the Javadoc tool. With the latest version, you may now execute your Ant scripts from the generated documentation: the execution is performed in a GUI called AntDoc GUI.

Within the AntDoc task, you should specify through the standard fileset element the Ant buildfiles that should be documented. Each matched Ant buildfile will be documented unless the top level project element has a name attribute.

At the moment, it is not possible to set the header, title and footer text as plain HTML; if you provide HTML, it will not be output correctly, but you will see the un-interpreted markup.

The main page is named index.html and it should be first opened when browsing the documentation. This HTML file encompasses two framesets:

The generated documentation also includes a CSS stylesheet named stylesheet.css, which you may customize at your will. Warning: each time that you re-generate the documentation, this stylesheet will be overwritten!

Note that the task generates temporary files and then deletes them.

Parameters


Attribute Description Type Default Required
destination The directory under which the HTML documentation is generated. If the directory does not exist and that it can be created, it is created. path ".", that is to say the current directory. no
buildfile The Ant buildfile which should be documented. If the attribute is set, the inner <fileset> are discarded path null for the moment (in the future ${ant.file}, that is to say the current Ant buildfile) no
antURL The URL of Ant official web site; or the local URL of your Ant documentation installation directory ($ANT_HOME/docs environment variable, ${ant.home}/docs Ant property). This URL will be used so as to generate documentation that enables to link a task use to its documentation.
In the case when you specify a local URL, do not forget to prepend the path with "file:/" (see example).
path http://jakarta.apache.org/ant, the current Ant web site. no
runtime

Indicates to AntDoc whether it should incorporate within the generated HTML pages, the necessary resources in order to be able to execute the targets from your browser. If it is enabled, some extra icons will be generated close to each documented target, and when clicking an icon, the target will be ready to be executed in the AntDoc GUI if available. Moreover, some input parameters will be displayed at the top of the HTML, in order to specify on what host and what port number the AntDoc GUI listens.

Do not forget to set ANT_HOME environment variable in that case, if local attribute is set to yes.

boolean no no
local

Indicates to AntDoc whether the generated HTML pages should use the local applet jar, or the one on the AntDoc "official" site. This attribute is only taken into account if runtime attribute is enabled. Very useful if you are behing a firewall that stops applets byte-code download

boolean no no
gui If enabled, launches the AntDoc GUI: documentation generated is discarded in that case. This GUI enables to run Ant targets selected in the HTML AntDoc. boolean no no
port Only used if gui is enabled. Specifies on which port number the AntDoc GUI should listen to incoming requests from the HTML generated AntDoc. integer 111 no

Parameters specified as nested elements

title

This is a no attribute element, which enables to specify a title to the generated documentation, just like Javadoc does. Beware, AntDoc only understands plain text at the moment (no HTML markup is allowed).

header

This is a no attribute element, which enables to specify a header to the generated documentation, just like Javadoc does. Beware, AntDoc only understands plain text at the moment (no HTML markup is allowed).

footer

Same as previous, except that it applies to the footer of the generated documentation.

fileset

The Ant build files. This element is only taken into account if the buildfile attribute is not defined! This nested element is an Ant
FileSet, which enables to define all the Ant build files which are bound to be documented. Each reachable file through this Ant FileSet will be considered as a Ant build file and will be documented.
As many fileset nested elements may be used. Note that no checking is performed to determine if the files specified are actually Ant build files.

filter

When using that element, you must have the jar of Jakarta RegExp present in $ANT_HOME/lib!

This element enables to filter the Ant target that are bound to be documented. The element itself is composed by exclude and include which are empty elements with a mandatory name attribute that should represent a regular expression. This regular expression must comply Regexp patterns, otherwise it is ignored.

Note that when this element is missing, no filtering is applied.

Now, when you wish not to generate documentation for all the Ant targets, you may create a filter element within the AntDoc element, and within that filter, create include and exclude elements with a name attribute equal to a regular expression that will be matched against each target element name attribute. If the overall filtering excludes the target, the target documentation will not be generated. As a consequence, and this is a temporary bug, the hyperlinks that point to it are incorrect!

When the set of filters both explicitely includes and excludes a given target, the Ant default directory-based policy applies:

Ant gives you two ways to create a subset, both of which can be used at the same time:

When both inclusion and exclusion are used, only files/directories that match the include patterns, and don't match the exclude patterns, are used.

You may easily transpose that rule to the AntDoc filtering mechanism.

Global example

Simplest examples

Here is the simplest example:
<taskdef
	name="AntDoc"
	classname="org.ed.pack.ant.AntDoc"
/>
<AntDoc
	destination="antdoc"
	buildfile="${ant.file}"
/>
This example generates the AntDoc for the current Ant buildfile. Note that no runtime is embedded to the generated HTML pages.

More customized example

Here comes an example that should be self-explanatory:
<taskdef
	name="AntDoc"
	classname="org.ed.pack.ant.AntDoc"
/>
<AntDoc
	destination="antdoc"
	antURL="file:/${ant.home}/docs"
>
	<filter>
		<include name="^antdoc."/>
		<include name="^usage"/>
		<include name="dummy"/>
		<exclude name="antdoc.test.out"/>
	</filter>
	<title>My Title</title>
	<header>My Header</header>
	<footer>My Footer</footer>
	<fileset dir="..">
		<include name="build.xml"/>
		<exclude name="*_build.xml"/>
	</fileset>
</AntDoc>
This example shows that the optional AntDoc should be "loaded dynamically" within the Ant build file script. But you do not have to put the AntDoc.jar file into the $ANT_HOME/lib directory, and instead, you may use the taskdef classpath attribute.
Copy and paste this example into your Ant build file so as to start with something you just have to customize very basically.
Edouard Mercier, 2002.10.02 22:13:06