stevel 2004/10/12 13:51:29
Modified: src/main/org/apache/tools/ant/taskdefs/compilers
AptCompilerAdapter.java
src/main/org/apache/tools/ant/taskdefs Apt.java
docs/manual tasksoverview.html coretasklist.html
Added: docs/manual/CoreTasks apt.html
Log:
Apt docs. Also flipped the nocompile flag in name and meaning
Revision Changes Path
1.1 ant/docs/manual/CoreTasks/apt.html
Index: apt.html
===================================================================
<html lang="en-us"><head>
<meta http-equiv="Content-Language" content="en-us"><title>Apt
Task</title></head>
<body>
<h2><a name="Apt">Apt</a></h2>
<h3>Description</h3>
<p>Runs the annotation processor tool (apt), and then optionally compiles
the original code, and any generated source code. This task requires
Java1.5 or later</p>
<p>This task inherits from the <a href="javac.html">Javac Task</a>, and thus
supports all of the same attributes, and subelements. In addition, it
supports
the following addition items:</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tbody><tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">compile</td>
<td valign="top">After running the Apt, should the code be compiled.
(see the
"-nocompile" flag on the Apt executable)</td>
<td align="center" valign="top">No, defaults to false.</td>
</tr>
<tr>
<td valign="top">factory</td>
<td valign="top">The fully qualified classname of the
AnnotationProcessFactory to be used
to construct annotation processors. This represents the
"-factory"
command line flag of the Apt executable.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">factorypathref</td>
<td valign="top">The reference id of the path used to find the classes
needed by the
AnnotationProcessorFactory (and the location of the
factory itself).
This represents the "-factorypath" flag on the Apt
executable.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">preprocessdir</td>
<td valign="top">The directory used for preprocessing. This is the
directory where the
generated source code will be place. This represents
the "-s" flag on
the Apt executable.</td>
<td align="center" valign="top">No</td>
</tr>
</tbody></table>
<h3>Parameters specified as nested elements</h3>
<h4>factorypath</h4>
<p>You can specify the path used to find the classes needed by the
AnnotationProcessorFactory
at runtime, using this element. It is represents as a generic path like
structure. This
represents the "-factorypath" flag on the Apt executable.</p>
<h4>option</h4>
<p>Used to represent a generic option to pass to Apt. This represents the
"-A" flag on the
Apt executable. You can specify zero or more <option> elements.</p>
<table border="1" cellpadding="2" cellspacing="0">
<tbody><tr>
<td valign="top" width="12%"><b>Attribute</b></td>
<td valign="top" width="78%"><b>Description</b></td>
<td valign="top" width="10%"><b>Required</b></td>
</tr>
<tr>
<td valign="top">name</td>
<td align="center">The name of the option</td>
<td align="center">Yes.</td>
</tr>
<tr>
<td valign="top">value</td>
<td align="center">The value to set the option to</td>
<td align="center">Yes.</td>
</tr>
</tbody></table>
<h3>Examples</h3>
<pre> <apt srcdir="${src}"
destdir="${build}"
classpath="xyz.jar"
debug="on"
compile="true"
factory="com.mycom.MyAnnotationProcessorFactory"
factorypathref="my.factorypath.id"
preprocessdir="${preprocess.dir}">
</apt></pre>
<p>compiles all <code>.java</code> files under the <code>${src}</code>
directory, and stores
the <code>.class</code> files in the <code>${build}</code> directory.
The classpath used includes <code>xyz.jar</code>, and compiling with
debug information is on. It also forces the generated source code to
be compiled. The generated source code will be placed in
<code>${preprocess.dir}</code> directory, using the class
<code>com.mycom.MyAnnotationProcessorFactory</code> to supply
AnnotationProcessor instances.</p>
<h3>Notes</h3>
<p>
The "compiler" attribute is ignored, as it is forced to use the Apt compiler
</p>
<p>Using the Apt compiler with the "compile" option set to "true"
forces you to use Sun's Apt compiler, which will use the JDK's Javac
compiler.
If you wish to use another compiler, you will first need run the Apt
processor
with the "compile" flag set to "false", and then use a
<code><javac></code> task to compile first your original source
code, and then the
generated source code:</p>
<pre> <Apt srcdir="${src}"
destdir="${build}"
classpath="xyz.jar"
debug="true"
compile="false"
factory="com.mycom.MyAnnotationProcessorFactory"
factorypathref="my.factorypath.id"
preprocessdir="${preprocess.dir}">
</apt>
<javac srcdir="${src}"
destdir="${build}"
classpath="xyz.jar"
debug="on" />
<javac srcdir="${preprocess.dir}"
destdir="${build}"
classpath="xyz.jar"
debug="true" />
</pre>
This may involve more build file coding, but the speedup gained from switching
to jikes may justify the effort.
<p>
</p><hr>
<p align="center">Copyright © 2004 The Apache Software Foundation.
All rights Reserved.</p>
</body></html>
1.2 +1 -1
ant/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java
Index: AptCompilerAdapter.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AptCompilerAdapter.java 8 Oct 2004 10:46:36 -0000 1.1
+++ AptCompilerAdapter.java 12 Oct 2004 20:51:29 -0000 1.2
@@ -49,7 +49,7 @@
static void setAptCommandlineSwitches(Apt apt, Commandline cmd) {
- if (apt.isNoCompile()) {
+ if (!apt.isCompile()) {
cmd.createArgument().setValue("-nocompile");
}
1.2 +5 -5 ant/src/main/org/apache/tools/ant/taskdefs/Apt.java
Index: Apt.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Apt.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Apt.java 8 Oct 2004 10:46:36 -0000 1.1
+++ Apt.java 12 Oct 2004 20:51:29 -0000 1.2
@@ -38,7 +38,7 @@
public class Apt
extends Javac {
- private boolean noCompile;
+ private boolean compile=true;
private String factory;
private Path factoryPath;
private Vector options;
@@ -101,12 +101,12 @@
return super.getCompiler();
}
- public boolean isNoCompile() {
- return noCompile;
+ public boolean isCompile() {
+ return compile;
}
- public void setNoCompile(boolean noCompile) {
- this.noCompile = noCompile;
+ public void setCompile(boolean compile) {
+ this.compile = compile;
}
public String getFactory() {
1.28 +6 -0 ant/docs/manual/tasksoverview.html
Index: tasksoverview.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/tasksoverview.html,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- tasksoverview.html 9 Feb 2004 21:50:05 -0000 1.27
+++ tasksoverview.html 12 Oct 2004 20:51:29 -0000 1.28
@@ -239,6 +239,12 @@
</tr>
<tr valign="top">
+ <td nowrap><a href="CoreTasks/apt.html">Apt</a></td>
+ <td><p>Runs the annotation processor tool (apt), and then optionally
compiles
+ the original code, and any generated source code.</p></td>
+ </tr>
+
+ <tr valign="top">
<td nowrap><a href="OptionalTasks/jspc.html">JspC</a></td>
<td><p>Runs the JSP compiler. It can be used to precompile JSP pages
for fast initial invocation of JSP pages, deployment on a server without
1.54 +1 -0 ant/docs/manual/coretasklist.html
Index: coretasklist.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/coretasklist.html,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- coretasklist.html 12 Mar 2004 15:11:35 -0000 1.53
+++ coretasklist.html 12 Oct 2004 20:51:29 -0000 1.54
@@ -19,6 +19,7 @@
<a href="CoreTasks/antcall.html">AntCall</a><br>
<a href="CoreTasks/antstructure.html">AntStructure</a><br>
<a href="CoreTasks/apply.html">Apply/<i>ExecOn</i></a><br>
+<a href="CoreTasks/apt.html">Apt</a><br>
<a href="CoreTasks/available.html">Available</a><br>
<a href="CoreTasks/basename.html">Basename</a><br>
<a href="CoreTasks/buildnumber.html">BuildNumber</a><br>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]