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 48KB

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