You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

antsupport.xml 50KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628
  1. <chapter id="antTasks" xreflabel="AspectJ Ant Tasks">
  2. <title>AspectJ Ant Tasks</title>
  3. <sect1 id="antTasks-intro">
  4. <title>Introduction</title>
  5. <para>
  6. AspectJ contains a compiler, <literal>ajc</literal>,
  7. that can be run from Ant.
  8. Included in the <literal>aspectjtools.jar</literal>
  9. are Ant binaries to support three
  10. ways of running the compiler:
  11. <orderedlist>
  12. <listitem>
  13. <para>
  14. <xref linkend="antTasks-iajc"/>,
  15. a task to run the AspectJ post-1.1 compiler,
  16. which supports all the eclipse and ajc options, including incremental mode.
  17. </para>
  18. </listitem>
  19. <listitem>
  20. <para>
  21. <xref linkend="antTasks-adapter"/>,
  22. an adapter class to run the new compiler using Javac tasks
  23. by setting the build.compiler property
  24. </para>
  25. </listitem>
  26. <listitem>
  27. <para>
  28. <xref linkend="antTasks-ajc"/>,
  29. a task to run build scripts compatible with the AspectJ 1.0 tasks
  30. </para>
  31. </listitem>
  32. </orderedlist>
  33. </para>
  34. <para>
  35. This describes how to install and use the tasks and the adapter.
  36. For an example Ant script, see
  37. <ulink url="../examples/build.xml">examples/build.xml</ulink>.
  38. </para>
  39. </sect1>
  40. <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . install -->
  41. <sect1 id="antTasks-install" xreflabel="Installing Ant Tasks">
  42. <title>Installing Ant Tasks</title>
  43. <para>
  44. Install Jakarta Ant 1.5.1:
  45. Please see the official Jakarta Ant website for more information
  46. and the 1.5.1 distribution. This release is source-compatible
  47. with Ant 1.3 and Ant 1.4, but the task sources must be
  48. compiled with those versions of the Ant libraries to be used
  49. under those versions of Ant.
  50. Sources are available under the Eclipse Public License v. 1.0
  51. at <ulink url="http://eclipse.org/aspectj">http://eclipse.org/aspectj</ulink>.
  52. </para>
  53. <para>
  54. In Ant 1.5, third-party tasks can be declared using a taskdef entry in
  55. the build script, to identify the name and classes.
  56. When declaring a task, include the
  57. <literal>aspectjtools.jar</literal> either in the
  58. taskdef classpath or in <literal>${ANT_HOME}/lib</literal> where it will be added
  59. to the system class path by the ant script.
  60. You may specify the task script names directly,
  61. or use the "resource" attribute to specify the default names:
  62. </para>
  63. <programlisting>
  64. <![CDATA[
  65. <taskdef
  66. resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/>
  67. ]]>
  68. </programlisting>
  69. <para>
  70. The current resource file retains the name "ajc" for the Ajc10 task,
  71. and uses "iajc" for the AspectJ post-1.1 task.
  72. </para>
  73. <para>
  74. In Ant 1.6, third-party tasks are declared in their own namespace
  75. using <literal>antlib.xml</literal>. For example, the following
  76. script would build and run the spacewar example, if you put the
  77. script in the examples directory and <literal>aspectjtools.jar</literal>
  78. in the <literal>${ANT_HOME}/lib</literal> directory.
  79. </para>
  80. <programlisting>
  81. <![CDATA[
  82. <project name="aspectj-ant1.6" default="spacewar"
  83. xmlns:aspectj="antlib:org.aspectj" basedir=".">
  84. <target name="spacewar">
  85. <aspectj:iajc
  86. argfiles="spacewar/debug.lst"
  87. outjar="spacewar.jar"
  88. classpath="../../lib/aspectjrt.jar"
  89. />
  90. <java classname="spacewar.Game"
  91. classpath="spacewar.jar:../../lib/aspectjrt.jar"/>
  92. </target>
  93. </project>
  94. ]]>
  95. </programlisting>
  96. <para>
  97. For more information on using Ant, please refer to Jakarta's
  98. documentation on integrating user-defined Ant tasks into builds.
  99. </para>
  100. </sect1>
  101. <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . iajc -->
  102. <sect1 id="antTasks-iajc" xreflabel="AjcTask (iajc)">
  103. <title>AjcTask (iajc)</title>
  104. <para>
  105. This task uses the AspectJ post-1.1 compiler ajc.
  106. The AspectJ compiler can be used like Javac to compile Java sources,
  107. but it can also compile AspectJ sources or weave binary aspects
  108. with Java bytecode.
  109. It can run in normal "batch" mode or in an "incremental" mode,
  110. where it only recompiles files it has to revisit.
  111. For more information on ajc, see <xref linkend="ajc-ref"/>.
  112. Unlike Javac or the Javac Ant task, this task always compiles the
  113. specified files since aspects can apply to other (updated) files.
  114. For a workaround, see <xref linkend="antTasks-iajc-uptodate"/>.
  115. </para>
  116. <para>
  117. Beyond the normal ajc compiler options, this task also supports
  118. an experimental option for an incremental "tag" file, and it
  119. can copy resources from source directories or
  120. input jars to the output jar or directory.
  121. </para>
  122. <para>
  123. This task is named iajc to avoid conflict with the 1.0 task ajc.
  124. </para>
  125. <sect2 id="antTasks-iajc-options" xreflabel="AjcTask (iajc) Options">
  126. <title>AjcTask (iajc) Options</title>
  127. <para>
  128. The following tables list the supported parameters.
  129. For any parameter specified as a Path, a single path can be
  130. specified directly as an attribute,
  131. multiple paths can be specified using a nested element of
  132. the same name, and a common path can be reused by defining it as a
  133. global and passing the id to the corresponding {name}ref attribute.
  134. See <xref linkend="antTasks-iajc-paths"/>
  135. below for more details.
  136. </para>
  137. <para>
  138. Most attributes and nested elements are optional.
  139. The compiler requires that the same version of
  140. <literal>aspectjrt.jar</literal>
  141. be specified on the classpath, and that some sources be
  142. be specified
  143. (using one or more of
  144. <literal>sourceroots</literal>,
  145. <literal>injars</literal>,
  146. <literal>inpath</literal>,
  147. <literal>argfiles</literal>, and/or
  148. <literal>srcdir</literal> (with patterns)).
  149. When in incremental mode, only
  150. <literal>sourceroots</literal> may be specified.
  151. </para>
  152. <para>Boolean parameters default to <literal>false</literal>
  153. unless otherwise stated.
  154. </para>
  155. <!-- . . . . . . . . . . . . . . . . iajc options table -->
  156. <!-- table (and caption/title) not supported by fop -->
  157. <para>
  158. <emphasis role="strong">
  159. AjcTask (iajc) options for specifying sources
  160. </emphasis>
  161. </para>
  162. <informaltable>
  163. <tgroup cols="2">
  164. <thead>
  165. <row>
  166. <entry>Attribute</entry>
  167. <entry>Description</entry>
  168. </row>
  169. </thead>
  170. <tbody>
  171. <row>
  172. <entry><para>argfiles, argfilesRef
  173. (<xref linkend="antTasks-iajc-paths"/>)
  174. </para></entry>
  175. <entry><para>
  176. An argument file contains a list of arguments read by the compiler.
  177. Each line is read into one element of the argument array
  178. and may include another argfile by reference.
  179. </para></entry>
  180. </row>
  181. <row>
  182. <entry><para>sourceRoots, sourceRootsRef
  183. (<xref linkend="antTasks-iajc-paths"/>)
  184. </para></entry>
  185. <entry><para>
  186. Directories containing source files (ending with .java or .aj) to compile.
  187. </para></entry>
  188. </row>
  189. <row>
  190. <entry><para>srcdir
  191. (<xref linkend="antTasks-iajc-paths"/>)
  192. </para></entry>
  193. <entry><para>
  194. Base directory of sources to compile, assuming there are
  195. <xref linkend="antTasks-nested-includes"/>.
  196. This approach uses the Ant process
  197. for matching .java files and is not compatible with incremental
  198. mode. Unless using filters to limit the sources included,
  199. use sourceroots instead.
  200. </para></entry>
  201. </row>
  202. <row>
  203. <entry><para>injars, injarsRef
  204. (<xref linkend="antTasks-iajc-paths"/>)
  205. </para></entry>
  206. <entry><para>
  207. Deprecated - use inpath instead.
  208. Read .class files for bytecode weaving
  209. from zip files (only).
  210. </para></entry>
  211. </row>
  212. <row>
  213. <entry><para>inpath, inpathRef
  214. (<xref linkend="antTasks-iajc-paths"/>)
  215. </para></entry>
  216. <entry><para>
  217. Read .class files for bytecode weaving
  218. from directories or zip files (like classpath).
  219. </para></entry>
  220. </row>
  221. <row>
  222. <entry><para>classpath, classpathRef
  223. (<xref linkend="antTasks-iajc-paths"/>)
  224. </para></entry>
  225. <entry><para>
  226. The classpath used by the sources being compiled.
  227. When compiling aspects, include the same version of the
  228. <literal>aspectjrt.jar</literal>.
  229. </para></entry>
  230. </row>
  231. <row>
  232. <entry><para>bootclasspath, bootclasspathRef
  233. (<xref linkend="antTasks-iajc-paths"/>)
  234. </para></entry>
  235. <entry><para>
  236. The bootclasspath specifies types to use instead of the
  237. invoking VM's when seeking types during compilation.
  238. </para></entry>
  239. </row>
  240. <row>
  241. <entry><para>extDirs, extDirsRef
  242. (<xref linkend="antTasks-iajc-paths"/>)
  243. </para></entry>
  244. <entry><para>
  245. The extension directories to use instead of those in the
  246. invoking VM when seeking types during compilation.
  247. </para></entry>
  248. </row>
  249. <row>
  250. <entry><para>aspectPath, aspectPathRef
  251. (<xref linkend="antTasks-iajc-paths"/>)
  252. </para></entry>
  253. <entry><para>
  254. Similar to classpath, aspectpath contains read-only,
  255. binary aspect libraries that are woven into sources
  256. but not included in the output.
  257. <literal>aspectpath</literal> accepts jar/zip files
  258. (but, unlike classpath, not directories).
  259. </para></entry>
  260. </row>
  261. </tbody>
  262. </tgroup>
  263. </informaltable>
  264. <para>
  265. <emphasis role="strong">
  266. AjcTask (iajc) options for specifying output
  267. </emphasis>
  268. </para>
  269. <informaltable>
  270. <tgroup cols="2">
  271. <thead>
  272. <row>
  273. <entry>Attribute</entry>
  274. <entry>Description</entry>
  275. </row>
  276. </thead>
  277. <tbody>
  278. <row>
  279. <entry><para>destDir
  280. </para></entry>
  281. <entry><para>
  282. The directory in which to place the generated class files.
  283. Only one of <literal>destDir</literal> and
  284. <literal>outJar</literal> may be set.
  285. </para></entry>
  286. </row>
  287. <row>
  288. <entry><para>outJar
  289. </para></entry>
  290. <entry><para>
  291. The zip file in which to place the generated output class files.
  292. Only one of <literal>destDir</literal> and
  293. <literal>outJar</literal> may be set.
  294. </para></entry>
  295. </row>
  296. <row>
  297. <entry><para>copyInjars
  298. </para></entry>
  299. <entry><para>
  300. (Deprecated/ignored; ajc does this.)
  301. If true, copy all non-.class files from input jar(s)
  302. to the output jar or destination directory after the
  303. compile (or incremental compile) completes.
  304. In forked mode, this copies only after the process
  305. completes, not after incremental compiles.
  306. </para></entry>
  307. </row>
  308. <row>
  309. <entry><para>sourceRootCopyFilter
  310. </para></entry>
  311. <entry><para>
  312. When set, copy all files from the sourceroot directories to the output jar
  313. or destination directory except those specified in the filter pattern.
  314. The pattern should be compatible with an Ant fileset excludes filter;
  315. when using this, most developers pass
  316. <literal>**/CVS/*,**/*.java</literal> to exclude any CVS directories
  317. or source files.
  318. See <literal>inpathDirCopyFilter</literal>.
  319. Requires <literal>destDir</literal> or <literal>outJar</literal>.
  320. </para></entry>
  321. </row>
  322. <row>
  323. <entry><para>inpathDirCopyFilter
  324. </para></entry>
  325. <entry>
  326. <para> When set, copy all files from the inpath directories
  327. to the output jar or destination directory except those
  328. specified in the filter pattern. The pattern should be
  329. compatible with an Ant fileset excludes filter; when
  330. using this, most developers pass
  331. <literal>**/CVS/*,**/*.java,**/*.class</literal> to
  332. exclude any CVS directories, source files, or unwoven
  333. .class files. (If <literal>**/*.class</literal> is not
  334. specified, it will be prepended to the filter.) See
  335. <literal>sourceRootCopyFilter</literal>. (Note that ajc
  336. itself copies all resources from input jar/zip files on
  337. the inpath.) Requires <literal>destDir</literal> or
  338. <literal>outJar</literal>.</para>
  339. </entry>
  340. </row>
  341. </tbody>
  342. </tgroup>
  343. </informaltable>
  344. <para>
  345. <emphasis role="strong">
  346. AjcTask (iajc) options for specifying compiler behavior
  347. </emphasis>
  348. </para>
  349. <informaltable>
  350. <tgroup cols="2">
  351. <thead>
  352. <row>
  353. <entry>Attribute</entry>
  354. <entry>Description</entry>
  355. </row>
  356. </thead>
  357. <tbody>
  358. <row>
  359. <entry><para>fork
  360. </para></entry>
  361. <entry><para>
  362. Run process in another VM.
  363. This gets the forking classpath either explicitly
  364. from a <literal>forkclasspath</literal> entry
  365. or by searching the task or system/Ant classpath for the
  366. first readable file with a name of the form
  367. <literal>aspectj{-}tools{.*}.jar</literal>.
  368. When forking you can specify the amount of memory used
  369. with <literal>maxmem</literal>.
  370. Fork cannot be used in incremental mode,
  371. unless using a tag file.
  372. </para></entry>
  373. </row>
  374. <row>
  375. <entry><para>forkclasspath, forkclasspathRef
  376. (<xref linkend="antTasks-iajc-paths"/>)
  377. </para></entry>
  378. <entry><para>
  379. Specify the classpath to use for the compiler when forking.
  380. </para></entry>
  381. </row>
  382. <row>
  383. <entry><para>maxmem
  384. </para></entry>
  385. <entry><para>
  386. The maximum memory to use for the new VM when fork is true.
  387. Values should have the same form as accepted by the VM, e.g., "128m".
  388. </para></entry>
  389. </row>
  390. <row>
  391. <entry><para>incremental
  392. </para></entry>
  393. <entry><para>
  394. incremental mode: Build once, then recompile only required source
  395. files when user provides input.
  396. Requires that source files be specified only using
  397. <literal>sourceroots</literal>.
  398. Incompatible with forking.
  399. </para></entry>
  400. </row>
  401. <row>
  402. <entry><para>tagfile
  403. </para></entry>
  404. <entry><para>
  405. incremental mode: Build once, then recompile only required source
  406. files when the tag file is updated, finally exiting when tag file
  407. is deleted.
  408. Requires that source files be specified only using
  409. <literal>sourceroots</literal>.
  410. </para></entry>
  411. </row>
  412. <row>
  413. <entry><para>X
  414. </para></entry>
  415. <entry><para>
  416. Set experimental option(s), using comma-separated list of accepted options
  417. Options should not contain the leading X.
  418. Some commonly-used experimental options have their
  419. own entries. The other permitted ones (currently) are
  420. serializableAspects, incrementalFile, lazyTjp,
  421. reweavable, notReweavable, noInline,
  422. terminateAfterCompilation,
  423. ajruntimelevel:1.2, and ajruntimelevel:1.5.
  424. Of these, some were deprecated in AspectJ 5
  425. (reweavable, terminateAfterCompilation, etc.).
  426. </para></entry>
  427. </row>
  428. <row>
  429. <entry><para>XterminateAfterCompilation
  430. </para></entry>
  431. <entry><para>
  432. Terminates before the weaving process, dumping out unfinished class files.
  433. </para></entry>
  434. </row>
  435. </tbody>
  436. </tgroup>
  437. </informaltable>
  438. <para>
  439. <emphasis role="strong">
  440. AjcTask (iajc) options for specifying compiler side-effects and messages
  441. </emphasis>
  442. </para>
  443. <informaltable>
  444. <tgroup cols="2">
  445. <thead>
  446. <row>
  447. <entry>Attribute</entry>
  448. <entry>Description</entry>
  449. </row>
  450. </thead>
  451. <tbody>
  452. <row>
  453. <entry><para>emacssym
  454. </para></entry>
  455. <entry><para>
  456. If true, emit <literal>.ajesym</literal> symbol files for Emacs support.
  457. </para></entry>
  458. </row>
  459. <row>
  460. <entry><para>crossref
  461. </para></entry>
  462. <entry><para>
  463. If true, emit <literal>.ajsym</literal> file into the output directory.
  464. </para></entry>
  465. </row>
  466. <row>
  467. <entry><para>verbose
  468. </para></entry>
  469. <entry><para>
  470. If true, log compiler verbose messages as Project.INFO during the compile.
  471. </para></entry>
  472. </row>
  473. <row>
  474. <entry><para>logCommand
  475. </para></entry>
  476. <entry><para>
  477. If true, log compiler command elements as Project.INFO
  478. (rather than the usual Project.VERBOSE level).
  479. </para></entry>
  480. </row>
  481. <row>
  482. <entry><para>Xlistfileargs
  483. </para></entry>
  484. <entry><para>
  485. If true, emit list of file arguments during
  486. the compile (but behaves now like verbose).
  487. </para></entry>
  488. </row>
  489. <row>
  490. <entry><para>version
  491. </para></entry>
  492. <entry><para>
  493. If true, do not compile - just print AspectJ version.
  494. </para></entry>
  495. </row>
  496. <row>
  497. <entry><para>help
  498. </para></entry>
  499. <entry><para>
  500. If true, just print help for the command-line compiler.
  501. </para></entry>
  502. </row>
  503. <row>
  504. <entry><para>Xlintwarnings
  505. </para></entry>
  506. <entry><para>
  507. Same as <literal>xlint:warning</literal>:
  508. if true, set default level of all language
  509. usage messages to warning.
  510. </para></entry>
  511. </row>
  512. <row>
  513. <entry><para>Xlint
  514. </para></entry>
  515. <entry><para>
  516. Specify default level of all language usage messages to one of
  517. [<literal>error warning ignore</literal>].
  518. </para></entry>
  519. </row>
  520. <row>
  521. <entry><para>XlintFile
  522. </para></entry>
  523. <entry><para>
  524. Specify property file containing <literal>name:level</literal> associations
  525. setting level for language messages emitted during compilation.
  526. Any levels set override the default associations in
  527. <literal>org/aspectj/weaver/XLintDefault.properties</literal>.
  528. </para></entry>
  529. </row>
  530. <row>
  531. <entry><para>failonerror
  532. </para></entry>
  533. <entry><para>
  534. If true, throw BuildException to halt build if there
  535. are any compiler errors.
  536. If false, continue notwithstanding compile errors.
  537. Defaults to <literal>true</literal>.
  538. </para></entry>
  539. </row>
  540. <row>
  541. <entry><para>messageHolderClass
  542. </para></entry>
  543. <entry><para>
  544. Specify a class to use as the message holder for the compile process.
  545. The entry must be a fully-qualified name of a class resolveable from
  546. the task classpath complying with the
  547. <literal>org.aspectj.bridge.IMessageHolder</literal> interface
  548. and having a public no-argument constructor.
  549. </para></entry>
  550. </row>
  551. <row>
  552. <entry><para>showWeaveInfo
  553. </para></entry>
  554. <entry><para>
  555. If true, emit weaver messages.
  556. Defaults to <literal>false</literal>.
  557. </para></entry>
  558. </row>
  559. </tbody>
  560. </tgroup>
  561. </informaltable>
  562. <para>
  563. <emphasis role="strong">
  564. AjcTask (iajc) options for specifying Eclipse compiler options
  565. </emphasis>
  566. </para>
  567. <informaltable>
  568. <tgroup cols="2">
  569. <thead>
  570. <row>
  571. <entry>Attribute</entry>
  572. <entry>Description</entry>
  573. </row>
  574. </thead>
  575. <tbody>
  576. <row>
  577. <entry><para>nowarn
  578. </para></entry>
  579. <entry><para>
  580. If true, same as <literal>warn:none</literal>.
  581. </para></entry>
  582. </row>
  583. <row>
  584. <entry><para>deprecation
  585. </para></entry>
  586. <entry><para>
  587. If true, same as <literal>warn:deprecation</literal>
  588. </para></entry>
  589. </row>
  590. <row>
  591. <entry><para>warn
  592. </para></entry>
  593. <entry><para>
  594. One or more comma-separated warning specifications from
  595. [<literal>constructorName packageDefaultMethod deprecation,
  596. maskedCatchBlocks unusedLocals unusedArguments,
  597. unusedImports syntheticAccess assertIdentifier</literal>].
  598. </para></entry>
  599. </row>
  600. <row>
  601. <entry><para>debug
  602. </para></entry>
  603. <entry><para>
  604. If true, same as <literal>debug:lines,vars,source</literal>
  605. </para></entry>
  606. </row>
  607. <row>
  608. <entry><para>debugLevel
  609. </para></entry>
  610. <entry><para>
  611. One or more comma-separated debug specifications from
  612. [<literal>lines vars source</literal>].
  613. </para></entry>
  614. </row>
  615. <row>
  616. <entry><para>PreserveAllLocals
  617. </para></entry>
  618. <entry><para>
  619. If true, code gen preserves all local variables (for debug purposes).
  620. </para></entry>
  621. </row>
  622. <row>
  623. <entry><para>noimporterror
  624. </para></entry>
  625. <entry><para>
  626. If true, emit no errors for unresolved imports.
  627. </para></entry>
  628. </row>
  629. <row>
  630. <entry><para>referenceinfo
  631. </para></entry>
  632. <entry><para>
  633. If true, compute reference info.
  634. </para></entry>
  635. </row>
  636. <row>
  637. <entry><para>log
  638. </para></entry>
  639. <entry><para>
  640. File to log compiler messages to.
  641. </para></entry>
  642. </row>
  643. <row>
  644. <entry><para>encoding
  645. </para></entry>
  646. <entry><para>Default source encoding format
  647. (per-file encoding not supported in Ant tasks).
  648. </para></entry>
  649. </row>
  650. <row>
  651. <entry><para>proceedOnError
  652. </para></entry>
  653. <entry><para>
  654. If true, keep compiling after errors encountered,
  655. dumping class files with problem methods.
  656. </para></entry>
  657. </row>
  658. <row>
  659. <entry><para>progress
  660. </para></entry>
  661. <entry><para>
  662. If true, emit progress (requires log).
  663. </para></entry>
  664. </row>
  665. <row>
  666. <entry><para>time
  667. </para></entry>
  668. <entry><para>
  669. If true, display speed information.
  670. </para></entry>
  671. </row>
  672. <row>
  673. <entry><para>target
  674. </para></entry>
  675. <entry><para>
  676. Specify target class file format as one of
  677. [<literal>1.1 1.2</literal>].
  678. Defaults to 1.1 class file.
  679. </para></entry>
  680. </row>
  681. <row>
  682. <entry><para>source
  683. </para></entry>
  684. <entry><para>
  685. Set source compliance level to one of
  686. [<literal>1.3 1.4 1.5</literal>]
  687. (default is 1.4).
  688. 1.3 implies -source 1.3 and -target 1.1.
  689. 1.4 implies -source 1.4 and -target 1.2.
  690. 1.5 implies -source 1.5 and -target 1.5.
  691. </para></entry>
  692. </row>
  693. <row>
  694. <entry><para>source
  695. </para></entry>
  696. <entry><para>
  697. Set source assertion mode to one of
  698. [<literal>1.3 1.4</literal>].
  699. Default depends on compliance mode.
  700. </para></entry>
  701. </row>
  702. </tbody>
  703. </tgroup>
  704. </informaltable>
  705. <!-- . . . . . . . . . . . . . . . . iajc options table -->
  706. </sect2>
  707. <sect2 id="antTasks-nested-includes" xreflabel="nested matches">
  708. <title>AjcTask matching parameters specified as nested elements</title>
  709. <para>
  710. This task forms an implicit FileSet and supports all attributes of
  711. <literal>&lt;fileset&gt;</literal> (dir becomes srcdir) as well as
  712. the nested
  713. <literal>&lt;include&gt;</literal>,
  714. <literal>&lt;exclude&gt;</literal>, and
  715. <literal>&lt;patternset&gt;</literal> elements.
  716. These can be used to specify source files.
  717. However, it is better to use <literal>sourceroots</literal>
  718. to specify source directories unless using filters to exclude
  719. some files from compilation.
  720. </para>
  721. </sect2>
  722. <sect2 id="antTasks-iajc-paths" xreflabel="Path">
  723. <title>AjcTask Path-like Structures</title>
  724. <para>
  725. Some parameters are path-like structures containing one or more
  726. elements; these are
  727. <literal>sourceroots</literal>,
  728. <literal>argfiles</literal>,
  729. <literal>injars</literal>,
  730. <literal>inpath</literal>,
  731. <literal>classpath</literal>,
  732. <literal>bootclasspath</literal>,
  733. <literal>forkclasspath</literal>, and
  734. <literal>aspectpath</literal>.
  735. In all cases, these may be specified as nested elements, something
  736. like this:
  737. </para>
  738. <programlisting>
  739. <![CDATA[
  740. <iajc {attributes..} />
  741. <{name}>
  742. <pathelement path="{first-location}"/>
  743. <pathelement path="{second-location}"/>
  744. ...
  745. <{name}>
  746. ...
  747. </iajc>
  748. ]]>
  749. </programlisting>
  750. <para>
  751. As with other Path-like structures, they may be defined elsewhere
  752. and specified using the refid attribute:
  753. </para>
  754. <programlisting>
  755. <![CDATA[
  756. <path id="aspect.path">
  757. <pathelement path="${home}/lib/persist.jar"/>
  758. <pathelement path="${home}/lib/trace.jar"/>
  759. </path>
  760. ...
  761. <iajc {attributes..} />
  762. <aspectpath refid="aspect.path"/>
  763. ...
  764. </iajc>
  765. ]]>
  766. </programlisting>
  767. <para>
  768. The task also supports an attribute <literal>{name}ref</literal>
  769. for each such parameter. E.g., for <literal>aspectpath</literal>:
  770. </para>
  771. <programlisting>
  772. <![CDATA[
  773. <iajc {attributes..} aspectpathref="aspect.path"/>
  774. ]]>
  775. </programlisting>
  776. </sect2>
  777. <sect2 id="antTasks-iajc-sample" xreflabel="Sample of iajc task">
  778. <title>Sample of iajc task</title>
  779. <para>
  780. A minimal build script defines the task and runs it, specifying the sources:
  781. </para>
  782. <programlisting>
  783. <![CDATA[
  784. <project name="simple-example" default="compile" >
  785. <taskdef
  786. resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
  787. <classpath>
  788. <pathelement location="${home.dir}/tools/aspectj/lib/aspectjtools.jar"/>
  789. </classpath>
  790. </taskdef>
  791. <target name="compile" >
  792. <iajc sourceroots="${home.dir}/ec/project/src"
  793. classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  794. </target>
  795. </project>
  796. ]]>
  797. </programlisting>
  798. <para>
  799. Below is script with most everything in it. The compile process...
  800. </para>
  801. <orderedlist>
  802. <listitem>
  803. <para>Runs in incremental mode, recompiling when the user hits return;
  804. </para>
  805. </listitem>
  806. <listitem>
  807. <para>Reads all the source files from two directories;
  808. </para>
  809. </listitem>
  810. <listitem>
  811. <para>Reads binary .class files from input jar and directory;
  812. </para>
  813. </listitem>
  814. <listitem>
  815. <para>Uses a binary aspect library for persistence;
  816. </para>
  817. </listitem>
  818. <listitem>
  819. <para>Outputs to an application jar; and
  820. </para>
  821. </listitem>
  822. <listitem>
  823. <para>Copies resources from the source directories and binary input
  824. jar and directories to the application jar. </para>
  825. </listitem>
  826. </orderedlist>
  827. <para>
  828. When this target is built, the compiler will build once and then
  829. wait for input from the user.
  830. Messages are printed as usual.
  831. When the user has quit, then this runs the application.
  832. </para>
  833. <!-- if program changed, test in docs/test/antScriptTest -->
  834. <programlisting>
  835. <![CDATA[
  836. <target name="build-test" >
  837. <iajc outjar="${home.dir}/output/application.jar"
  838. sourceRootCopyFilter="**/CVS/*,**/*.java"
  839. inpathDirCopyFilter="**/CVS/*,**/*.java,**/*.class"
  840. incremental="true" >
  841. <sourceroots>
  842. <pathelement location="${home.dir}/ec/project/src"/>
  843. <pathelement location="${home.dir}/ec/project/testsrc"/>
  844. </sourceroots>
  845. <inpath>
  846. <pathelement location="${home.dir}/build/module.jar"/>
  847. <pathelement location="${home.dir}/build/binary-input"/>
  848. </inpath>
  849. <aspectpath>
  850. <pathelement location="${home.dir}/ec/int/persist.jar"/>
  851. </aspectpath>
  852. <classpath>
  853. <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  854. </classpath>
  855. </iajc>
  856. <java classname="org.smart.app.Main">
  857. <classpath>
  858. <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  859. <pathelement location="${home.dir}/ec/int/persist.jar"/>
  860. <pathelement location="${home.dir}/output/application.jar"/>
  861. </classpath>
  862. </java>
  863. </target>
  864. ]]>
  865. </programlisting>
  866. <para>
  867. For an example of a build script,
  868. see <ulink url="../examples/build.xml">
  869. ../examples/build.xml</ulink>.
  870. </para>
  871. </sect2>
  872. <sect2 id="antTasks-iajc-uptodate" xreflabel="Avoiding clean compiles">
  873. <title>Avoiding clean compiles</title>
  874. <para>
  875. Unlike javac, the ajc compiler always processes all input because
  876. new aspects can apply to updated classes and vice-versa.
  877. However, in the case where no files have been updated, there
  878. is no reason to recompile sources. One way to implement that
  879. is with an explicit dependency check using the uptodate task:
  880. </para>
  881. <programlisting>
  882. <![CDATA[
  883. <target name="check.aspects.jar">
  884. <uptodate property="build.unnecessary"
  885. targetfile="${aspects.module-jar}" >
  886. <srcfiles dir="${src1}" includes="**/*.aj"/>
  887. <srcfiles dir="${src2}/" includes="**/*.aj"/>
  888. </uptodate>
  889. </target>
  890. <target name="compile.aspects" depends="prepare,check.aspects.jar"
  891. unless="build.unnecessary">
  892. <iajc ...
  893. ]]>
  894. </programlisting>
  895. <para>
  896. When using this technique, be careful to verify that binary
  897. input jars are themselves up-to-date after they would have been
  898. modified by any build commands.
  899. </para>
  900. </sect2>
  901. <sect2 id="programmatically-handling-compiler-messages" xreflabel="programmatically-handling-compiler-messages">
  902. <title>Programmatically handling compiler messages</title>
  903. <para>
  904. Users may specify a message holder to which the compiler will pass
  905. all messages as they are generated. This will override all of the
  906. normal message printing, but does not prevent the task from failing
  907. if exceptions were thrown or if failonerror is true and the compiler
  908. detected errors in the sources.
  909. </para>
  910. <para>
  911. Handling messages programmatically could be useful when using the
  912. compiler to verify code. If aspects consist of declare [error|warning],
  913. then the compiler can act to detect invariants in the code being
  914. processed. For code to compare expected and actual messages, see the
  915. AspectJ testing module (which is not included in the binary
  916. distribution).
  917. </para>
  918. </sect2>
  919. </sect1>
  920. <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . adapter -->
  921. <sect1 id="antTasks-adapter" xreflabel="Ajc11CompilerAdapter (javac)">
  922. <title>Ajc11CompilerAdapter (javac)</title>
  923. <para>
  924. This CompilerAdapter can be used in javac task calls by setting the
  925. <literal>build.compiler</literal> property.
  926. This enables users to to easily switch between the Javac and AspectJ
  927. compilers.
  928. However, the Javac task's pruning of source files prevents the
  929. adapter from doing a correct compile in some cases,
  930. so use AjcTask where possible.
  931. </para>
  932. <sect2 id="antTasks-adapter-sample" xreflabel="Sample of compiler adapter">
  933. <title>Sample of compiler adapter</title>
  934. <para>
  935. To build using the adapter, put the
  936. <literal>aspectjtools.jar</literal>
  937. on the system/ant classpath (e.g., in
  938. <literal>${ANT_HOME}/lib</literal>)
  939. and define the
  940. <literal>build.compiler</literal>
  941. property as the fully-qualified name of the class,
  942. <literal>org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter</literal>.
  943. </para>
  944. <para>
  945. The AspectJ compiler should run for any compile using the Javac task
  946. (for options, see the Ant documentation for the Javac task).
  947. For example, the call below passes all out-of-date source files in the
  948. <literal>src/org/aspectj</literal> subdirectories to the
  949. <literal>ajc</literal> command along with the destination directory:
  950. </para>
  951. <programlisting>
  952. <![CDATA[
  953. -- command:
  954. cp aspectj1.1/lib/aspectjtools.jar ant/lib
  955. ant/bin/ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter ...
  956. -- task invocation in the build script:
  957. <javac srcdir="src" includes="org/aspectj/**/*.java" destdir="dest" />
  958. ]]>
  959. </programlisting>
  960. <para>
  961. To pass ajc-specific arguments, use a compilerarg entry.
  962. </para>
  963. <programlisting>
  964. <![CDATA[
  965. -- command
  966. Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter
  967. -- build script
  968. <property name="ajc"
  969. value="org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter"/>
  970. <javac srcdir="src" includes="org/aspectj/**/*.java" destdir="dest" >
  971. <compilerarg compiler="${ajc}" line="-argfile src/args.lst"/>
  972. <javac/>
  973. ]]>
  974. </programlisting>
  975. </sect2>
  976. <sect2 id="antTasks-adapter-options" xreflabel="Compiler adapter compilerarg options">
  977. <title>Compiler adapter compilerarg options</title>
  978. <para>
  979. The adapter supports any ajc command-line option passed using compilerarg,
  980. as well as the following options available only in AjcTask.
  981. Find more details on the following options in <xref linkend="antTasks-iajc"/>.
  982. </para>
  983. <itemizedlist>
  984. <listitem><para>
  985. <literal>-Xmaxmem</literal>:
  986. set maximum memory for forking (also settable in javac).
  987. </para></listitem>
  988. <listitem><para>
  989. <literal>-Xlistfileargs</literal>:
  990. list file arguments (also settable in javac).
  991. </para></listitem>
  992. <listitem><para>
  993. <literal>-Xfailonerror</literal>:
  994. throw BuildException on compiler error (also settable in javac).
  995. </para></listitem>
  996. <listitem><para>
  997. <literal>-Xmessageholderclass</literal>:
  998. specify fully-qualified name of class to use as the message holder.
  999. </para></listitem>
  1000. <listitem><para>
  1001. <literal>-Xcopyinjars</literal>:
  1002. copy resources from any input jars to output
  1003. (default behavior since 1.1.1)
  1004. </para></listitem>
  1005. <listitem><para>
  1006. <literal>-Xsourcerootcopyfilter {filter}</literal>:
  1007. copy resources from source directories to output (minus files specified in filter)
  1008. </para></listitem>
  1009. <listitem><para>
  1010. <literal>-Xtagfile {file}</literal>:
  1011. use file to control incremental compilation
  1012. </para></listitem>
  1013. <listitem><para>
  1014. <literal>-Xsrcdir {dir}</literal>:
  1015. add to list of ajc source roots (all source files will be included).
  1016. </para></listitem>
  1017. </itemizedlist>
  1018. <para>
  1019. Special considerations when using Javac and compilerarg:
  1020. </para>
  1021. <itemizedlist>
  1022. <listitem><para>
  1023. The names above may differ slightly from what you might expect
  1024. from AjcTask; use these forms when specifying compilerarg.
  1025. </para></listitem>
  1026. </itemizedlist>
  1027. <itemizedlist>
  1028. <listitem><para>
  1029. By default the adapter will mimic the Javac task's copying of resource
  1030. files by specifying
  1031. <literal>"**/CVS/*,**/*.java,**/*.aj"</literal>
  1032. for the sourceroot copy filter.
  1033. To change this behavior, supply your own value
  1034. (e.g., <literal>"**/*"</literal> to copy nothing).
  1035. </para></listitem>
  1036. </itemizedlist>
  1037. <itemizedlist>
  1038. <listitem><para>
  1039. Warning - define the system property
  1040. <literal>build.compiler.clean</literal> to compile all files,
  1041. when available.
  1042. Javac prunes the source file list of "up-to-date" source files
  1043. based on the timestamps of corresponding .class files,
  1044. and will not compile if no sources are out of date.
  1045. This is wrong for ajc which requires all the files for each compile
  1046. and which may refer indirectly to sources using argument files.
  1047. </para>
  1048. <para>
  1049. To work around this, set the global property
  1050. <literal>build.compiler.clean</literal>.
  1051. This tells the compiler adapter to delete all .class files
  1052. in the destination directory and re-execute the javac
  1053. task so javac can recalculate the list of source files. e.g.,
  1054. </para>
  1055. <programlisting>
  1056. <![CDATA[
  1057. Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter
  1058. -Dbuild.compiler.clean=anything ...
  1059. ]]>
  1060. </programlisting>
  1061. <para>
  1062. Caveats to consider when using this global
  1063. <literal>build.compiler.clean</literal> property:
  1064. </para>
  1065. <orderedlist>
  1066. <listitem><para>
  1067. If javac believes there are no out-of-date source files,
  1068. then the adapter is never called and cannot clean up,
  1069. and the "compile" will appear to complete successfully
  1070. though it did nothing.
  1071. </para></listitem>
  1072. <listitem><para>
  1073. Cleaning will makes stepwise build processes fail if
  1074. they depend on the results of the prior compilation being
  1075. in the same directory, since cleaning deletes all .class files.
  1076. </para></listitem>
  1077. <listitem><para>
  1078. This clean process only permits one compile process at a
  1079. time for each destination directory because it tracks
  1080. recursion by writing a tag file to the destination directory.
  1081. </para></listitem>
  1082. <listitem><para>
  1083. When running incrementally, the clean happens only before
  1084. the initial compile.
  1085. </para></listitem>
  1086. </orderedlist>
  1087. </listitem>
  1088. </itemizedlist>
  1089. </sect2>
  1090. </sect1>
  1091. <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . Ajc10 -->
  1092. <sect1 id="antTasks-ajc" xreflabel="Ajc10 (ajc)">
  1093. <title>Ajc10 (ajc)</title>
  1094. <para>
  1095. This task handles the same arguments as those used by the AspectJ 1.0 task.
  1096. This should permit those with existing build scripts using the Ajc Ant
  1097. task to continue using the same scripts when compiling with 1.1.
  1098. This will list any use of options no longer supported in 1.1
  1099. (e.g., <literal>lenient, strict, workingdir, preprocess, usejavac</literal>,...),
  1100. and does not provide access to the new features of AspectJ 1.1.
  1101. (Developers using AspectJ 1.1 only should upgrade their scripts
  1102. to use AjcTask instead. This will not work for AspectJ 1.2 or later.)
  1103. </para>
  1104. <sect2 id="antTasks-ajc-options" xreflabel="Ajc10 (ajc) Options">
  1105. <title>Ajc10 (ajc) Options</title>
  1106. <para>
  1107. </para>
  1108. <para>
  1109. Most attributes and nested elements are optional.
  1110. The compiler requires that the same version of
  1111. <literal>aspectjrt.jar</literal>
  1112. be specified on the classpath, and that some sources be
  1113. be specified
  1114. (using one or more of
  1115. <literal>argfiles</literal> and
  1116. <literal>srcdir</literal> (with patterns)).
  1117. </para>
  1118. <para>Boolean parameters default to <literal>false</literal>
  1119. unless otherwise stated.
  1120. </para>
  1121. <!-- . . . . . . . . . . . . . . . . ajc options table -->
  1122. <table>
  1123. <title>AjcTask (ajc) options for specifying sources</title>
  1124. <tgroup cols="2">
  1125. <thead>
  1126. <row>
  1127. <entry>Attribute</entry>
  1128. <entry>Description</entry>
  1129. </row>
  1130. </thead>
  1131. <tbody>
  1132. <row>
  1133. <entry><para>srcdir
  1134. </para></entry>
  1135. <entry><para>
  1136. The base directory of the java files.
  1137. See
  1138. </para></entry>
  1139. </row>
  1140. <row>
  1141. <entry><para>destdir
  1142. </para></entry>
  1143. <entry><para>
  1144. The target directory for the output .class files
  1145. </para></entry>
  1146. </row>
  1147. <row>
  1148. <entry><para>includes
  1149. </para></entry>
  1150. <entry><para>
  1151. Comma-separated list of patterns of files that must be included.
  1152. No files are included when omitted.
  1153. </para></entry>
  1154. </row>
  1155. <row>
  1156. <entry><para>includesfile
  1157. </para></entry>
  1158. <entry><para>
  1159. The path to a file containing include patterns.
  1160. </para></entry>
  1161. </row>
  1162. <row>
  1163. <entry><para>excludes
  1164. </para></entry>
  1165. <entry><para>
  1166. Comma-separated list of patterns of files that must be excluded.
  1167. No files (except default excludes) are excluded when omitted.
  1168. </para></entry>
  1169. </row>
  1170. <row>
  1171. <entry><para>excludesfile
  1172. </para></entry>
  1173. <entry><para>
  1174. The path to a file containing exclude patterns.
  1175. </para></entry>
  1176. </row>
  1177. <row>
  1178. <entry><para>defaultexcludes
  1179. </para></entry>
  1180. <entry><para>
  1181. If true, then default excludes are used.
  1182. Default excludes are used when omitted
  1183. (i.e., defaults to <literal>true</literal>).
  1184. </para></entry>
  1185. </row>
  1186. <row>
  1187. <entry><para>classpath, classpathref
  1188. </para></entry>
  1189. <entry><para>
  1190. The classpath to use,
  1191. optionally given as a reference to a classpath Path
  1192. element defined elsewhere.
  1193. </para></entry>
  1194. </row>
  1195. <row>
  1196. <entry><para>bootclasspath, bootclasspathref
  1197. </para></entry>
  1198. <entry><para>
  1199. The bootclasspath to use,
  1200. optionally given as a reference to a bootclasspath Path
  1201. element defined elsewhere.
  1202. </para></entry>
  1203. </row>
  1204. <row>
  1205. <entry><para>extdirs
  1206. </para></entry>
  1207. <entry><para>
  1208. Paths to directories containting installed extensions.
  1209. </para></entry>
  1210. </row>
  1211. <row>
  1212. <entry><para>debug
  1213. </para></entry>
  1214. <entry><para>
  1215. If true, emit debug info in the .class files.
  1216. </para></entry>
  1217. </row>
  1218. <row>
  1219. <entry><para>deprecation
  1220. </para></entry>
  1221. <entry><para>
  1222. If true, emit messages about use of deprecated API.
  1223. </para></entry>
  1224. </row>
  1225. <row>
  1226. <entry><para>verbose
  1227. </para></entry>
  1228. <entry><para>
  1229. Emit compiler status messages during the compile.
  1230. </para></entry>
  1231. </row>
  1232. <row>
  1233. <entry><para>version
  1234. </para></entry>
  1235. <entry><para>
  1236. Emit version information and quit.
  1237. </para></entry>
  1238. </row>
  1239. <row>
  1240. <entry><para>failonerror
  1241. </para></entry>
  1242. <entry><para>
  1243. If true, throw BuildException to halt build if there
  1244. are any compiler errors.
  1245. If false, continue notwithstanding compile errors.
  1246. Defaults to <literal>true</literal>.
  1247. </para></entry>
  1248. </row>
  1249. <row>
  1250. <entry><para>source
  1251. </para></entry>
  1252. <entry><para>
  1253. Value of -source option - ignored unless <literal>1.4</literal>.
  1254. </para></entry>
  1255. </row>
  1256. </tbody>
  1257. </tgroup>
  1258. </table>
  1259. <table>
  1260. <title>Parameters ignored by the old ajc taskdef,
  1261. but now supported or buggy</title>
  1262. <tgroup cols="3">
  1263. <thead>
  1264. <row>
  1265. <entry>Attribute</entry>
  1266. <entry>Description</entry>
  1267. <entry>Supported?</entry>
  1268. </row>
  1269. </thead>
  1270. <tbody>
  1271. <row>
  1272. <entry><para>encoding
  1273. </para></entry>
  1274. <entry><para>Default encoding of source files.
  1275. </para></entry>
  1276. <entry><para>yes
  1277. </para></entry>
  1278. </row>
  1279. <row>
  1280. <entry><para>optimize
  1281. </para></entry>
  1282. <entry><para>
  1283. Whether source should be compiled with optimization.
  1284. </para></entry>
  1285. <entry><para>yes?
  1286. </para></entry>
  1287. </row>
  1288. <row>
  1289. <entry><para>target
  1290. </para></entry>
  1291. <entry><para>
  1292. Generate class files for specific VM version, one of
  1293. [<literal>1.1 1.2</literal>].
  1294. </para></entry>
  1295. <entry><para>yes
  1296. </para></entry>
  1297. </row>
  1298. <row>
  1299. <entry><para>depend
  1300. </para></entry>
  1301. <entry><para>
  1302. Enables dependency-tracking.
  1303. </para></entry>
  1304. <entry><para>no
  1305. </para></entry>
  1306. </row>
  1307. <row>
  1308. <entry><para>includeAntRuntime
  1309. </para></entry>
  1310. <entry><para>
  1311. Whether to include the Ant run-time libraries.
  1312. </para></entry>
  1313. <entry><para>no
  1314. </para></entry>
  1315. </row>
  1316. <row>
  1317. <entry><para>includeJavaRuntime
  1318. </para></entry>
  1319. <entry><para>
  1320. Whether to include the run-time libraries from the executing VM.
  1321. </para></entry>
  1322. <entry><para>no
  1323. </para></entry>
  1324. </row>
  1325. <row>
  1326. <entry><para>threads
  1327. </para></entry>
  1328. <entry><para>Multi-threaded compilation
  1329. </para></entry>
  1330. <entry><para>no
  1331. </para></entry>
  1332. </row>
  1333. </tbody>
  1334. </tgroup>
  1335. </table>
  1336. <para>
  1337. The following table shows that many of the unique parameters in
  1338. AspectJ 1.0 are no longer supported.
  1339. </para>
  1340. <table>
  1341. <title>Parameters unique to ajc</title>
  1342. <tgroup cols="3">
  1343. <thead>
  1344. <row>
  1345. <entry>Attribute</entry>
  1346. <entry>Description</entry>
  1347. </row>
  1348. </thead>
  1349. <tbody>
  1350. <row>
  1351. <entry><para>X
  1352. </para></entry>
  1353. <entry><para>
  1354. deprecated X options include
  1355. reweavable (on by default)
  1356. reweavable:compress (compressed by default)
  1357. </para></entry>
  1358. </row>
  1359. <row>
  1360. <entry><para>emacssym
  1361. </para></entry>
  1362. <entry><para>
  1363. Generate symbols for Emacs IDE support.
  1364. </para></entry>
  1365. </row>
  1366. <row>
  1367. <entry><para>argfiles
  1368. </para></entry>
  1369. <entry><para>
  1370. A comma-delimited list of argfiles that contain a line-delimited
  1371. list of source file paths (absolute or relative to the argfile).
  1372. </para></entry>
  1373. </row>
  1374. </tbody>
  1375. </tgroup>
  1376. </table>
  1377. <sect3>
  1378. <title>argfiles - argument list files</title>
  1379. <para>
  1380. An argument file is a file (usually <literal>{file}.lst</literal>)
  1381. containing a list of source file paths
  1382. (absolute or relative to the argfile).
  1383. You can use it to specify all source files to be compiled,
  1384. which ajc requires to avoid searching every possible source file
  1385. in the source path when building aspects.
  1386. If you specify an argfile to the ajc task, it will not include all
  1387. files in any specified source directory (which is the default
  1388. behavior for the Javac task when no includes are specified).
  1389. Conversely, if you specify excludes, they will be removed from
  1390. the list of files compiled even if they were specified
  1391. in an argument file.
  1392. </para>
  1393. <para>
  1394. The compiler also accepts arguments that are not source files,
  1395. but the IDE support for such files varies, and Javac does not
  1396. support them. Be sure to include exactly one argument on each line.
  1397. </para>
  1398. </sect3>
  1399. </sect2>
  1400. <sect2 id="antTasks-ajc-nested">
  1401. <title>Ajc10 parameters specified as nested elements</title>
  1402. <para>
  1403. This task forms an implicit FileSet and supports all attributes of
  1404. <literal>&lt;fileset&gt;</literal> (dir becomes srcdir) as well as
  1405. the nested
  1406. <literal>&lt;include&gt;</literal>,
  1407. <literal>&lt;exclude&gt;</literal>, and
  1408. <literal>&lt;patternset&gt;</literal> elements.
  1409. These can be used to specify source files.
  1410. </para>
  1411. <para>
  1412. <literal>ajc</literal>'s
  1413. <literal>srcdir</literal>,
  1414. <literal>classpath</literal>,
  1415. <literal>bootclasspath</literal>,
  1416. <literal>extdirs</literal>, and
  1417. <literal>jvmarg</literal>
  1418. attributes are path-like structures and can also be set via nested
  1419. <literal>&lt;src&gt;</literal>,
  1420. <literal>&lt;classpath&gt;</literal>,
  1421. <literal>&lt;bootclasspath&gt;</literal>,
  1422. <literal>&lt;extdirs&gt;</literal>, and
  1423. <literal>&lt;jvmargs&gt;</literal> elements, respectively.
  1424. </para>
  1425. </sect2>
  1426. <sect2 id="antTasks-ajc-sample" xreflabel="Sample of ajc task">
  1427. <title>Sample of ajc task</title>
  1428. <para>
  1429. Following is a declaration for the ajc task and a sample invocation
  1430. that uses the ajc compiler to compile the files listed in
  1431. <literal>default.lst</literal> into the dest dir:
  1432. </para>
  1433. <programlisting>
  1434. <![CDATA[
  1435. <project name="example" default="compile" >
  1436. <taskdef name="ajc"
  1437. classname="org.aspectj.tools.ant.taskdefs.Ajc10" >
  1438. <!-- declare classes needed to run the tasks and tools -->
  1439. <classpath>
  1440. <pathelement location="${home.dir}/tools/aspectj/lib/aspectjtools.jar"/>
  1441. </classpath>
  1442. </taskdef>
  1443. <target name="compile" >
  1444. <mkdir dir="dest" />
  1445. <ajc destdir="dest" argfiles="default.lst" >
  1446. <!-- declare classes needed to compile the target files -->
  1447. <classpath>
  1448. <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  1449. </classpath>
  1450. </ajc>
  1451. </target>
  1452. </project>
  1453. ]]>
  1454. </programlisting>
  1455. <para>
  1456. This build script snippet
  1457. </para>
  1458. <programlisting>
  1459. <![CDATA[
  1460. <ajc srcdir="${src}"
  1461. destdir="${build}"
  1462. argfiles="demo.lst"
  1463. />
  1464. ]]>
  1465. </programlisting>
  1466. <para>
  1467. compiles all .java files specified in the demo.lst and stores the .class files in the ${build} directory. Unlike the Javac task, the includes attribute is empty by default, so only those files specified in demo.lst are included.
  1468. </para>
  1469. <para>
  1470. This next example
  1471. </para>
  1472. <programlisting>
  1473. <![CDATA[
  1474. <ajc srcdir="${src}"
  1475. destdir="${build}"
  1476. includes="spacewar/*,coordination/*"
  1477. excludes="spacewar/Debug.java"
  1478. />
  1479. ]]>
  1480. </programlisting>
  1481. <para>
  1482. compiles .java files under the <literal>${src}</literal> directory in the
  1483. spacewar and coordination packages, and stores the .class files in the
  1484. <literal>${build}</literal> directory.
  1485. All source files under spacewar/ and coordination/ are used, except Debug.java.
  1486. </para>
  1487. <para>
  1488. See <ulink url="../examples/build.xml">../examples/build.xml</ulink>
  1489. for an example build script.
  1490. </para>
  1491. </sect2>
  1492. </sect1>
  1493. <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . problems -->
  1494. <sect1 id="antTasks-problems">
  1495. <title>Isolating problems running the Ant tasks</title>
  1496. <para>
  1497. If you have problems with the tasks not solved by the documentation,
  1498. please try to see if you have the same problems when running ajc
  1499. directly on the command line.
  1500. </para>
  1501. <itemizedlist>
  1502. <listitem><para>
  1503. If the problem occurs on the command line also, then the problem
  1504. is not in the task.
  1505. (It may be in the tools; please send bug reports.)
  1506. </para></listitem>
  1507. <listitem><para>
  1508. If the problem does not occur on the command line, then it may
  1509. lie in the parameters you are supplying in Ant or in the task's
  1510. handling of them.
  1511. </para></listitem>
  1512. <listitem><para>
  1513. If the build script looks correct and the problem only occurs when
  1514. building from Ant, then please send a report
  1515. (including your build file, if possible).
  1516. </para></listitem>
  1517. </itemizedlist>
  1518. <sect2 id="antTasks-knownProblems">
  1519. <title>Known issues with the Ant tasks</title>
  1520. <para>
  1521. For the most up-to-date information on known problems,
  1522. see the
  1523. <ulink url="http://bugs.eclipse.org/bugs">bug database</ulink>
  1524. for unresolved
  1525. <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&amp;product=AspectJ&amp;component=Compiler&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED">
  1526. compiler bugs
  1527. </ulink> or
  1528. <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&amp;product=AspectJ&amp;component=Ant&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED">
  1529. taskdef bugs
  1530. </ulink>.
  1531. </para>
  1532. <para>
  1533. When running Ant build scripts under Eclipse 2.x variants, you will get a
  1534. VerifyError because the Eclipse Ant support fails to isolate the Ant runtime
  1535. properly. To run in this context, set up iajc to fork (and use forkclasspath).
  1536. Eclipse 3.0 will fork Ant processes to avoid problems like this.
  1537. </para>
  1538. <para>
  1539. Memory and forking: Users email most often about the ajc task running
  1540. out of memory.
  1541. This is not a problem with the task; some compiles take a lot of
  1542. memory, often more than similar compiles using javac.
  1543. </para>
  1544. <para>
  1545. Forking is now supported in both the
  1546. <xref linkend="antTasks-adapter"/> and
  1547. <xref linkend="antTasks-iajc"/>,
  1548. and you can set the maximum memory available.
  1549. You can also not fork and increase the memory available to Ant
  1550. (see the Ant documentation, searching for ANT_OPTS,
  1551. the variable they use in their scripts to pass VM options,
  1552. e.g., ANT_OPTS=-Xmx128m).
  1553. </para>
  1554. </sect2>
  1555. <sect2 id="antTasks-feedback">
  1556. <title>Ant task questions and bugs</title>
  1557. <para>
  1558. For questions, you can send email to
  1559. <ulink url="mailto:aspectj-users@dev.eclipse.org">
  1560. aspectj-users@dev.eclipse.org</ulink>.
  1561. (Do join the list to participate!)
  1562. We also welcome any bug reports, patches, and features;
  1563. you can submit them to the bug database at
  1564. <ulink url="http://bugs.eclipse.org/bugs">
  1565. http://bugs.eclipse.org/bugs</ulink>
  1566. using the AspectJ product and Ant component.
  1567. </para>
  1568. </sect2>
  1569. </sect1>
  1570. </chapter>
  1571. <!-- Local variables: -->
  1572. <!-- fill-column: 79 -->
  1573. <!-- sgml-local-ecat-files: devguide.ced -->
  1574. <!-- sgml-parent-document:("devguide.sgml" "book" "refentry") -->
  1575. <!-- End: -->