1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<title>AjcTask Ant Support for AspectJ 1.1</title>
</head>
<body>
<h2>
<a NAME="ajc"></a>AjcTask Ant Support for AspectJ 1.1</h2>
<h3>
Description</h3>
This task uses the AspectJ<small><sup>tm</sup></small> 1.1 compiler
<code>ajc</code>.
The AspectJ compiler can be used like
<a href="http://jakarta.apache.org/ant/manual/CoreTasks/javac.html">Javac</a>
to compile Java sources, but it can also compile AspectJ sources or
weave binary aspects with Java bytecode. It can run in normal "batch" mode
or in an "incremental" mode, where it only recompiles files it has to revisit.
For more information on <tt>ajc</tt>, see the links from
the <a href="index.html">AspectJ docs home</a>. The main things to remember:
<ul>
<li>In incremental mode, sources may only be specified using source root directories.
</li>
<li>A .class file may only be woven once. That means
binaries in injars or aspectjpath must have been compiled with jikes or javac
or, if using ajc, with noweave.
</li>
</ul>
This task is named <tt>iajc</tt> now to avoid conflict with the
1.0 task <tt>ajc</tt>, but the name may change to <tt>ajc</tt> in
the future.
<p>
See <a href="#compilerMessages">below</a> for
an introduction to handling compiler messages programmatically.
<p>
<h3>
Parameters</h3>
<h4>Parameters supported by <code>ajc</code></h4>
<table BORDER CELLSPACING=0 CELLPADDING=2 >
<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>
<th colspan="3">Specifying source and destination files</th>
</tr>
<td VALIGN=TOP>sourceroots</td>
<td VALIGN=TOP>a list of base directories of the source files.
All source files (.java and .aj) in the base directories are compiled.
May also be specified as a <a href="nestedElements">nested element</a>.
</td>
<td ALIGN=CENTER VALIGN=TOP>Yes, in incremental mode.</td>
</tr>
<tr>
<td VALIGN=TOP>outjar</td>
<td VALIGN=TOP>Path to an output jar to generate with all output classes.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>destdir</td>
<td VALIGN=TOP>Specify where to place the generated class files.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>classpath</td>
<td VALIGN=TOP>the classpath required by the source files to compile.
May also be specified as a <a href="nestedElements">nested element</a>.
</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>srcdir</td>
<td VALIGN=TOP>the nested source base directory to compile,
specified as a <a href="nestedElements">nested element</a>.
</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>aspectpath</td>
<td VALIGN=TOP>the aspectpath to use -- like classpath, only for
read-only, binary aspect libraries (only accepts jar/zip files, no directories).
May also be specified as a <a href="nestedElements">nested element</a>.
</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>bootclasspath</td>
<td VALIGN=TOP>location of bootstrap class files.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>classpathref</td>
<td VALIGN=TOP>the classpath to use, given as a<a href="http://jakarta.apache.org/ant/manual/using.html#references">
reference</a> to a PATH defined elsewhere.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>bootclasspathref</td>
<td VALIGN=TOP>location of bootstrap class files, given as a <a href="http://jakarta.apache.org/ant/manual/using.html#references">reference</a>
to a PATH defined elsewhere.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<th colspan="3">Specifying compiler behavior</th>
</tr>
<tr>
<td VALIGN=TOP>noweave</td>
<td VALIGN=TOP>If true, produce binaries for the -injars option (only) --
defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>incremental</td>
<td VALIGN=TOP>build once, then recompile on demand only required files;
defaults to <tt>false</tt>.
By default, files are recompiled based on input passed to stdin
(see tagfile)</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>tagfile</td>
<td VALIGN=TOP>File that controls when incremental builds are done
and when the task completes.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>X</td>
<td VALIGN=TOP>Set experimental option(s), using comma-separated list
of accepted options (unlisted here -- for XLint, use
the xlint entries). Options should not contain the leading X.</td> <!-- XXX list -->
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<th colspan="3">Specifying compiler side-effects and messages</th>
</tr>
<tr>
<td VALIGN=TOP>verbose</td>
<td VALIGN=TOP>whether to emit compiler status messages during the compile;
defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>version</td>
<td VALIGN=TOP>if true, do not compile - just print AspectJ version;
defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>help</td>
<td VALIGN=TOP>if true, just print help for the command-line compiler;
defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>Xlintenabled</td>
<td VALIGN=TOP>same as <tt>xlint:all</tt>,
whether to emit language usage messages during the compile;
defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>Xlintfile</td>
<td VALIGN=TOP>specify property file containing name:level associations
for any overrides to the default associations for language usage
messaged emitted during the compile.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<!--
<tr>
<td VALIGN=TOP>Xlint</td>
<td VALIGN=TOP>Specify which language usage messages to emit
during compile, using comma-separated list of entries.
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
-->
<tr>
<td VALIGN=TOP>failonerror</td>
<td VALIGN=TOP>whether the build continues notwithstanding compile errors;
defaults to <tt>true</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>messageholderclass</td>
<td VALIGN=TOP>Specify a class to use as the message holder for the compile
process. The entry must be a fully-qualified name of a class resolveable
from the task classpath complying with the <tt>org.aspectj.bridge.IMessageHolder</tt>
interface and having a public no-argument constructor.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<th colspan="3">Eclipse compiler options</th>
</tr>
<tr>
<td VALIGN=TOP>nowarn</td>
<td VALIGN=TOP>same as <tt>warn:none</tt>;
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>deprecation</td>
<td VALIGN=TOP>same as <tt>warn:deprecation</tt>;
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>warn</td>
<td VALIGN=TOP>one or more comma-separated warning specifications:
constructorName,
packageDefaultMethod,
deprecation,
maskedCatchBlocks,
unusedLocals,
unusedArguments,
unusedImports,
syntheticAccess, or
assertIdentifier.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>debug</td>
<td VALIGN=TOP>same as <tt>debug:lines,vars,source</tt></td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>debuglevel</td>
<td VALIGN=TOP>comma-separated list lines, vars, or source,
indicating to add debugging information for lines,
variables, or source</tt></td> <!-- XXX weak -->
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>PreserveAllLocals</td>
<td VALIGN=TOP>code gen preserve all local variables (for debug purposes);
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>noimporterror</td>
<td VALIGN=TOP>no errors for unresolved imports;
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>referenceinfo</td>
<td VALIGN=TOP>compute reference info;
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>log</td>
<td VALIGN=TOP>File to log compiler messages to.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>encoding</td>
<td VALIGN=TOP>default source encoding format</td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>proceedonerror</td>
<td VALIGN=TOP>keep compiling when error, dumping class files with problem methods;
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>progress</td>
<td VALIGN=TOP>show progress (requires log);
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>time</td>
<td VALIGN=TOP>display speed information;
defaults to <tt>false</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>noexit</td>
<td VALIGN=TOP>disable System.exit (kills Ant -- use failonerror);
defaults to <tt>true</tt>. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>target</td>
<td VALIGN=TOP>Specify target class file format (must be "1.1" or "1.2");
defaults to 1.1 class file. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>compliance</td>
<td VALIGN=TOP>Set "1.3" or "1.4" source compliance level
(e.g., no import from default package in 1.4);
defaults to 1.3 compliance level. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
<tr>
<td VALIGN=TOP>source</td>
<td VALIGN=TOP>source assertion mode ("1.3" or "1.4");
default depends on compliance mode. </td>
<td ALIGN=CENTER VALIGN=TOP>No</td>
</tr>
</table>
<a name="nestedElements"></a>
<h3>Nested Elements</h3>
This taskdef should support nested elements as the old one did;
see <a href="taskdef-ajc10.html#nestedElements">taskdef-ajc10.html#nestedElements</a>.
<a name="compilerMessages"></>
<h3>Programmatically handling compiler messages</h3>
Users may specify a message holder which is passed all
messages generated by the compiler synchronously. This overrides all of the normal
message printing, but does not prevent the task from failing if failonerror is true
and errors or exceptions were encountered.
Handling messages programmatically could be useful
when using the compiler to inspect code.
If aspects consist of declare [error|warning], then
the compiler can act to detect invariants in the code being processed.
For code to compare expected and actual messages, see the AspectJ
testing module (which is not included in the binary distribution).
<hr>
<center>
</center>
</body>
</html>
|