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

features.html 56 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- Content Stylesheet for Site -->
  3. <!-- start the processing -->
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  7. <meta name="author" value="Conor MacNeill">
  8. <meta name="email" value="">
  9. <title>Mutant Proposal - Mutant Features</title>
  10. </head>
  11. <body bgcolor="#ffffff" text="#000000" link="#525D76">
  12. <table border="0" width="100%" cellspacing="0">
  13. <!-- TOP IMAGE -->
  14. <tr>
  15. <td colspan="2">
  16. <a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" align="left" border="0"/></a>
  17. </td>
  18. </tr>
  19. </table>
  20. <table border="0" width="100%" cellspacing="4">
  21. <tr><td colspan="2">
  22. <hr noshade="" size="1"/>
  23. </td></tr>
  24. <tr>
  25. <!-- LEFT SIDE NAVIGATION -->
  26. <td valign="top" nowrap="true">
  27. <p><strong>Mutant Proposal</strong></p>
  28. <ul>
  29. <li> <a href="./index.html">Introduction</a>
  30. </li>
  31. <li> <a href="./goals.html">Design Goals</a>
  32. </li>
  33. <li> <a href="./features.html">User Features</a>
  34. </li>
  35. <li> <a href="./developers.html">Task Developers</a>
  36. </li>
  37. <li> <a href="./design.html">Design Description</a>
  38. </li>
  39. </ul>
  40. </td>
  41. <td align="left" valign="top">
  42. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  43. <tr><td bgcolor="#525D76">
  44. <font color="#ffffff" face="arial,helvetica,sanserif">
  45. <a name="User Features"><strong>User Features</strong></a>
  46. </font>
  47. </td></tr>
  48. <tr><td>
  49. <blockquote>
  50. <p>
  51. This page describes the major features in Mutant which are significantly
  52. different from those of Ant1. These are covered from a user perspective. Other
  53. pages describe the differences from the perspectives of a task developer and an
  54. Ant core developer.
  55. </p>
  56. </blockquote>
  57. </td></tr>
  58. </table>
  59. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  60. <tr><td bgcolor="#525D76">
  61. <font color="#ffffff" face="arial,helvetica,sanserif">
  62. <a name="Directory Layout"><strong>Directory Layout</strong></a>
  63. </font>
  64. </td></tr>
  65. <tr><td>
  66. <blockquote>
  67. <p>
  68. When Mutant is installed, the most immediately obvious difference will be in the
  69. directory layout, particularly the lib directory. Where Ant1's lib directory
  70. contained ant.jar, optional.jar and the bundled XML jars, Mutant's lib directory
  71. contain a number of subdirectories.
  72. </p>
  73. <p>
  74. In the root directory, there are a number of jars. These jars are the startup
  75. jars
  76. </p>
  77. <table>
  78. <tr>
  79. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  80. valign="top" align="left">
  81. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  82. init.jar
  83. </font>
  84. </td>
  85. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  86. valign="top" align="left">
  87. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  88. a set of low level utility routines required at startup
  89. </font>
  90. </td>
  91. </tr>
  92. <tr>
  93. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  94. valign="top" align="left">
  95. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  96. start.jar
  97. </font>
  98. </td>
  99. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  100. valign="top" align="left">
  101. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  102. the Mutant launcher class
  103. </font>
  104. </td>
  105. </tr>
  106. <tr>
  107. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  108. valign="top" align="left">
  109. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  110. ant.jar
  111. </font>
  112. </td>
  113. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  114. valign="top" align="left">
  115. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  116. old Ant1 entry point
  117. </font>
  118. </td>
  119. </tr>
  120. </table>
  121. <p>
  122. The subdirectories have the following functions
  123. </p>
  124. <table>
  125. <tr>
  126. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  127. valign="top" align="left">
  128. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  129. parser
  130. </font>
  131. </td>
  132. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  133. valign="top" align="left">
  134. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  135. The XML parser jars. This is not available to task libraries unless
  136. they explicitly indicate that it is required.
  137. </font>
  138. </td>
  139. </tr>
  140. <tr>
  141. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  142. valign="top" align="left">
  143. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  144. antcore
  145. </font>
  146. </td>
  147. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  148. valign="top" align="left">
  149. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  150. Mutant's core classes. These classes are not available to
  151. tasks.
  152. </font>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  157. valign="top" align="left">
  158. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  159. common
  160. </font>
  161. </td>
  162. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  163. valign="top" align="left">
  164. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  165. classes which are available to both the core and all task
  166. libraries.
  167. </font>
  168. </td>
  169. </tr>
  170. <tr>
  171. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  172. valign="top" align="left">
  173. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  174. syslibs/antlibs
  175. </font>
  176. </td>
  177. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  178. valign="top" align="left">
  179. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  180. Task libraries. The distinction between the two is
  181. discussed below.
  182. </font>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  187. valign="top" align="left">
  188. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  189. frontend
  190. </font>
  191. </td>
  192. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  193. valign="top" align="left">
  194. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  195. Ant Frontends. Different frontends may be plugged in by placing
  196. jars here.
  197. </font>
  198. </td>
  199. </tr>
  200. </table>
  201. <p>
  202. The directory a jar is in will control the visibility of the jar's classes and
  203. resources. This is closely related to the classloader hiearchy used by
  204. Mutant.
  205. </p>
  206. </blockquote>
  207. </td></tr>
  208. </table>
  209. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  210. <tr><td bgcolor="#525D76">
  211. <font color="#ffffff" face="arial,helvetica,sanserif">
  212. <a name="Ant Libraries"><strong>Ant Libraries</strong></a>
  213. </font>
  214. </td></tr>
  215. <tr><td>
  216. <blockquote>
  217. <p>
  218. Mutant supports the concept of Ant Libraries. These are collections of
  219. components (tasks and types) and their supporting classes packaged into a
  220. Jar. In Mutant each library has a globally unique identifier. This identifier
  221. uses the same conventions as Java package naming - i.e. a reverse DNS name.
  222. </p>
  223. <p> The jar does not need to be exclusively for Ant. For example, it may be the
  224. jar for a tool which wishes to provide some Ant tasks for using the tool. It
  225. could be the main jar of an appication server that bundles Ant tasks for
  226. deployment. The jar does not even need to be installed in Mutant's antlib
  227. directory - Mutant can be configured to look in jars in other locations for Ant
  228. Libraries. </p>
  229. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  230. <tr><td bgcolor="#828DA6">
  231. <font color="#ffffff" face="arial,helvetica,sanserif">
  232. <a name="Ant library descriptor"><strong>Ant library descriptor</strong></a>
  233. </font>
  234. </td></tr>
  235. <tr><td>
  236. <blockquote>
  237. <p>
  238. Whatever the jar contains and wherever it is located, Mutant looks for an XML
  239. based descriptor in the jar at META-INF/antlib.xml. This XML file describes the
  240. components in the jar that will be available to Mutant.
  241. </p>
  242. <p>
  243. Here is an example of the descriptor.
  244. </p>
  245. <div align="left">
  246. <table cellspacing="4" cellpadding="0" border="0">
  247. <tr>
  248. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  249. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  250. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  251. </tr>
  252. <tr>
  253. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  254. <td bgcolor="#ffffff"><pre>
  255. &lt;antlib libid=&quot;ant.system&quot;
  256. home=&quot;http://jakarta.apache.org/ant&quot;&gt;
  257. &lt;taskdef name=&quot;libpath&quot; classname=&quot;org.apache.ant.antlib.system.LibPath&quot;/&gt;
  258. &lt;taskdef name=&quot;loadlib&quot; classname=&quot;org.apache.ant.antlib.system.LoadLib&quot;/&gt;
  259. &lt;taskdef name=&quot;import&quot; classname=&quot;org.apache.ant.antlib.system.Import&quot;/&gt;
  260. &lt;converter classname=&quot;org.apache.ant.antlib.system.FileConverter&quot;/&gt;
  261. &lt;converter classname=&quot;org.apache.ant.antlib.system.URLConverter&quot;/&gt;
  262. &lt;converter classname=&quot;org.apache.ant.antlib.system.PrimitiveConverter&quot;/&gt;
  263. &lt;aspect classname=&quot;org.apache.ant.antlib.system.AntAspect&quot;/&gt;
  264. &lt;/antlib&gt;
  265. </pre></td>
  266. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  267. </tr>
  268. <tr>
  269. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  270. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  271. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  272. </tr>
  273. </table>
  274. </div>
  275. <p>
  276. As a user you generally won't need to worry about this decriptor. The library
  277. developer will have developed it to describe their library. Mutant uses the
  278. descriptor to understand what Ant related components the library provides.
  279. </p>
  280. </blockquote>
  281. </td></tr>
  282. </table>
  283. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  284. <tr><td bgcolor="#828DA6">
  285. <font color="#ffffff" face="arial,helvetica,sanserif">
  286. <a name="Loading libraries"><strong>Loading libraries</strong></a>
  287. </font>
  288. </td></tr>
  289. <tr><td>
  290. <blockquote>
  291. <p>
  292. Library management in Mutant is split into two phases - a loading phase and an
  293. import phase. The loading phase is where Mutant loads the antlib.xml descriptor
  294. from the library. After loading, Mutant knows where the library is located and
  295. what components it provides. In general Mutant will not make the components
  296. available to build scripts automatically. A build script needs to notify Mutant
  297. what components it is using from each library. This is known as importing.
  298. </p>
  299. <p> Mutant loads libraries from two locations within the Mutant directory
  300. structure when Mutant starts up - the lib/syslibs and lib/antlibs directories.
  301. The distinction between these two locations is explained in the configuration
  302. discussion below. All jars in these directories will be search for library
  303. descriptors. All libraries providing descriptors will be available for importing
  304. into builds</p>
  305. <p> In addition to the automatically loaded libraries, it is possible to
  306. explicitly request additional libraries to be loaded using the
  307. <code>&lt;loadlib&gt;</code> task. Individual libraries may be loaded or a set
  308. of libraries loaded from a directory. Libraries may also be loaded from remote
  309. locations by specifying a URL. The loadlib task can request that all components
  310. in the loaded library also be imported at the time of loading. Examples of the
  311. loadlib task follow </p>
  312. <div align="left">
  313. <table cellspacing="4" cellpadding="0" border="0">
  314. <tr>
  315. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  316. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  317. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  318. </tr>
  319. <tr>
  320. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  321. <td bgcolor="#ffffff"><pre>
  322. &lt;!-- load a library from a specific file and import all components --&gt;
  323. &lt;loadlib file=&quot;/opt/tools/toollib.jar&quot; importall=&quot;true&quot;/&gt;
  324. &lt;!-- load all libraries from a directory --&gt;
  325. &lt;loadlib dir=&quot;/opt/appserver/lib/&quot;/&gt;
  326. &lt;!-- load libraries from a remote server --&gt;
  327. &lt;loadlib url=&quot;http://jakarta.apache.org/ant/testtasks.jar&quot;/&gt;
  328. </pre></td>
  329. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  330. </tr>
  331. <tr>
  332. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  333. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  334. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  335. </tr>
  336. </table>
  337. </div>
  338. <p>
  339. In general the loading of libraries from absolute locations would be a
  340. configuration task. These would be specified in the Mutant configuration file
  341. and would not be used in a build file. The loading of project libraries from
  342. relative locations may be something that you would see in a build file.
  343. </p>
  344. </blockquote>
  345. </td></tr>
  346. </table>
  347. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  348. <tr><td bgcolor="#828DA6">
  349. <font color="#ffffff" face="arial,helvetica,sanserif">
  350. <a name="Importing components"><strong>Importing components</strong></a>
  351. </font>
  352. </td></tr>
  353. <tr><td>
  354. <blockquote>
  355. <p>
  356. Mutant is designed to allow tasks to be defined simply by dropping a jar in a
  357. directory or configuring Mutant to look in particular places for jars. This will
  358. allow tasks and types developed by many different developers to be used. With
  359. many developers developing tasks, however, inevitably some tasks will end up
  360. with the same name.
  361. </p>
  362. <p>
  363. This is very similar to the situation faced by Java with Java class names.
  364. Many Java classes have the same name. When a Java programmer uses a class they
  365. must import that class with an import statement. This tells the Java compiler
  366. which particular class is being referenced by the classname. Effectively the
  367. import statement creates a mapping from a name used in the Java source file and
  368. a class in the global package namespace.
  369. </p>
  370. <p>
  371. Mutant provides an import task to specify, in a manner similar to Java's import
  372. statement, which components are being used. When a component is imported the
  373. library is identified by its unique id. By default the component is imported
  374. into the frame using the name it is known by within the library. When this would
  375. conflict with a name that has already been imported, the import task allows the
  376. component to be given a new name, or alias, by which it will be referenced. It
  377. is also possible to import all the components in a library. The folowing example
  378. shows the various methods by which the import task can be used to import
  379. components.
  380. </p>
  381. <div align="left">
  382. <table cellspacing="4" cellpadding="0" border="0">
  383. <tr>
  384. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  385. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  386. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  387. </tr>
  388. <tr>
  389. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  390. <td bgcolor="#ffffff"><pre>
  391. &lt;!-- import the runtool task from the com.foo.tools library --&gt;
  392. &lt;import libraryId=&quot;com.foo.tools&quot; name=&quot;runtool&quot;/&gt;
  393. &lt;!-- import the runtool task from the com.bar.tools library and
  394. alias it since the runtool is already defined --&gt;
  395. &lt;import libraryId=&quot;com.bar.tools&quot; name=&quot;runtool&quot; alias=&quot;runbartool&quot;/&gt;
  396. &lt;!-- import all of the tasks from the com.fubar.tools library --&gt;
  397. &lt;import libraryId=&quot;com.fubar.tools&quot;/&gt;
  398. </pre></td>
  399. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  400. </tr>
  401. <tr>
  402. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  403. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  404. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  405. </tr>
  406. </table>
  407. </div>
  408. <p>
  409. By using library identifiers, import operations are not tied to a particular
  410. library location. The separation of the loading and importing into separate
  411. phases allows environment-dependent locations to be specified as configuration
  412. information and location independent importing to be specified in the build
  413. file. This is similar to the case of Java imports. Java classes are imported by
  414. their global name without needing to known where the classfile is that contains
  415. that class. That information is provided externally in the CLASSPATH variable.
  416. </p>
  417. </blockquote>
  418. </td></tr>
  419. </table>
  420. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  421. <tr><td bgcolor="#828DA6">
  422. <font color="#ffffff" face="arial,helvetica,sanserif">
  423. <a name="Library classpath management"><strong>Library classpath management</strong></a>
  424. </font>
  425. </td></tr>
  426. <tr><td>
  427. <blockquote>
  428. <p>
  429. Many libraries will have dependencies on external jars. For example, a task
  430. might make use of regular-expression libraries such as jakarta-regexp or a task
  431. may provide a wrapper around some external tool. In these cases the task will
  432. usually need to have the required classes available in the classloader from
  433. which the task itself was loaded. It is possible to avoid these direct
  434. dependencies using techniques such as reflection and explicitly loading the
  435. required classes through additional classloaders but the code is often harder to
  436. write and understand.
  437. </p>
  438. <p> It is not always possible or desirable to bundle the required classes in the
  439. task's jar nor is it desirable that the system classpath contains the required
  440. classes. In fact it is often preferable to run Mutant with an empty classpath.
  441. Buildfiles which do not assume that the system classpath contains particular
  442. classes are generally more portable. Mutant provides a task,
  443. <code>&lt;libpath&gt;</code>, to allow additional paths to be assodicated with a
  444. library. As with the loadlib task, the libpath task may be used to associate a
  445. single file, all jars in a directory or remote jars with a library. </p>
  446. <div align="left">
  447. <table cellspacing="4" cellpadding="0" border="0">
  448. <tr>
  449. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  450. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  451. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  452. </tr>
  453. <tr>
  454. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  455. <td bgcolor="#ffffff"><pre>
  456. &lt;libpath libraryid=&quot;ant.ant1compat&quot;
  457. dir=&quot;/home/conor/jakarta-ant/lib/optional/&quot;/&gt;
  458. </pre></td>
  459. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  460. </tr>
  461. <tr>
  462. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  463. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  464. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  465. </tr>
  466. </table>
  467. </div>
  468. <p> The above example associates all the jars in
  469. /home/conor/jakarta-ant/lib/optional/ with the library whose unique id is
  470. ant.ant1compat. A path must be associated with a library before any components
  471. are imported from the library. Mutant associates the paths with the library and
  472. at the time a component is requested from the library, Mutant will form the
  473. classloader that will be used. The additional paths are added to the definition
  474. of the classloader. Once a component is loaded, further paths will not have any
  475. effect. For this reason, and since the additonal paths are likely to be absolute
  476. paths, the <code>&lt;libpath&gt;</code> task is normally used in Mutant's
  477. configuration phase. </p>
  478. </blockquote>
  479. </td></tr>
  480. </table>
  481. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  482. <tr><td bgcolor="#828DA6">
  483. <font color="#ffffff" face="arial,helvetica,sanserif">
  484. <a name="Automatic Imports"><strong>Automatic Imports</strong></a>
  485. </font>
  486. </td></tr>
  487. <tr><td>
  488. <blockquote>
  489. <p>
  490. Mutant will automatically import all components of any library whose unique
  491. identifier begins with "ant." when the ;library is loaded. This is
  492. mainly a convenience to provide a minimum set of tasks with which to construct
  493. build files.
  494. </p>
  495. </blockquote>
  496. </td></tr>
  497. </table>
  498. </blockquote>
  499. </td></tr>
  500. </table>
  501. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  502. <tr><td bgcolor="#525D76">
  503. <font color="#ffffff" face="arial,helvetica,sanserif">
  504. <a name="Includes"><strong>Includes</strong></a>
  505. </font>
  506. </td></tr>
  507. <tr><td>
  508. <blockquote>
  509. <p>Mutant provides a mechanism for including build file fragments into a build
  510. file. This following example illustrates how this works</p>
  511. <div align="left">
  512. <table cellspacing="4" cellpadding="0" border="0">
  513. <tr>
  514. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  515. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  516. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  517. </tr>
  518. <tr>
  519. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  520. <td bgcolor="#ffffff"><pre>
  521. build.ant
  522. ==========
  523. &lt;project default=&quot;main&quot; xmlns:ant=&quot;http://jakarta.apache.org/ant&quot;&gt;
  524. &lt;ant:include fragment=&quot;fragment.ant&quot;/&gt;
  525. &lt;/project&gt;
  526. fragment.ant
  527. ============
  528. &lt;fragment&gt;
  529. &lt;target name=&quot;main&quot;&gt;
  530. &lt;echo message=&quot;main target&quot;/&gt;
  531. &lt;/target&gt;
  532. &lt;/fragment&gt;
  533. </pre></td>
  534. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  535. </tr>
  536. <tr>
  537. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  538. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  539. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  540. </tr>
  541. </table>
  542. </div>
  543. <p> The include mechanism can be used to include a complete project file or as
  544. shown in the example, a fragment. When including a project, any attributes on
  545. the included <code>&lt;project&gt;</code> element are ignored and the contents
  546. of the project inserted into the including project. In all cases the included
  547. files must be a well formed XML file containing a root element. </p>
  548. <div align="left">
  549. <table cellspacing="4" cellpadding="0" border="0">
  550. <tr>
  551. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  552. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  553. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  554. </tr>
  555. <tr>
  556. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  557. <td bgcolor="#ffffff">
  558. <p><font color="red">This area of Mutant is subject to change.</font></p>
  559. <p>At present include elements are processed at parse-time. As such they can
  560. only occur at the top-level of the build file. They cannot occur in a target.
  561. The use of the namespace to qualify the include element is intended to convey
  562. the fact that this is not part of the build structure.</p>
  563. <p>An alternative approach would be to define include as a regular task. When an
  564. include is processed, the top-level tasks of the included project would be
  565. executed immediately and the targets added to the current project
  566. structure.</p>.
  567. </td>
  568. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  569. </tr>
  570. <tr>
  571. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  572. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  573. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  574. </tr>
  575. </table>
  576. </div>
  577. </blockquote>
  578. </td></tr>
  579. </table>
  580. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  581. <tr><td bgcolor="#525D76">
  582. <font color="#ffffff" face="arial,helvetica,sanserif">
  583. <a name="Project References"><strong>Project References</strong></a>
  584. </font>
  585. </td></tr>
  586. <tr><td>
  587. <blockquote>
  588. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  589. <tr><td bgcolor="#828DA6">
  590. <font color="#ffffff" face="arial,helvetica,sanserif">
  591. <a name="Creating references"><strong>Creating references</strong></a>
  592. </font>
  593. </td></tr>
  594. <tr><td>
  595. <blockquote>
  596. <p>
  597. Mutant allows build file writers to reference properties and targets in other
  598. projects by creating a project reference. Project references are introduced
  599. using the ref task.
  600. </p>
  601. <div align="left">
  602. <table cellspacing="4" cellpadding="0" border="0">
  603. <tr>
  604. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  605. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  606. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  607. </tr>
  608. <tr>
  609. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  610. <td bgcolor="#ffffff"><pre>
  611. &lt;!-- create a reference to the main build --&gt;
  612. &lt;ref project=&quot;main.xml&quot; name=&quot;main&quot;/&gt;
  613. &lt;ref project=&quot;test.xml&quot; name=&quot;test&quot;&gt;
  614. &lt;property name=build.dir&quot; value=&quot;build/test&quot;/&gt;
  615. &lt;/ref&gt;
  616. </pre></td>
  617. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  618. </tr>
  619. <tr>
  620. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  621. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  622. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  623. </tr>
  624. </table>
  625. </div>
  626. <p>
  627. The above example creates two project references - one to the build in main.xml
  628. and one to the build in test.xml. When a reference is created, it must be given
  629. a label. This label will be used to refer to items within the referenced
  630. project (see below). Note that the ref task is a regular task and the reference
  631. is only created when the ref task is executed. A ref task may be placed at the
  632. top level of a build to effectively create static references. Alternatively a
  633. reference may be created dynamically by putting the ref task in a target.
  634. </p>
  635. </blockquote>
  636. </td></tr>
  637. </table>
  638. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  639. <tr><td bgcolor="#828DA6">
  640. <font color="#ffffff" face="arial,helvetica,sanserif">
  641. <a name="Referencing project items"><strong>Referencing project items</strong></a>
  642. </font>
  643. </td></tr>
  644. <tr><td>
  645. <blockquote>
  646. <p>
  647. The label given to a project reference is used when accessing items within the
  648. project. So, to access the build.dir property in the project referenced by the
  649. main label, you would use main:build.dir. Similarly the compile target would be
  650. referred to as main:compile. Since the referenced projects may also create their
  651. own project references, labels may be concatenated to access items at arbitrary
  652. depths. For example, if main.xml referenced another project under the label
  653. "sub", a property debug could be referenced as main:sub:debug. The
  654. following example shows various items in the referenced project being used.
  655. </p>
  656. <div align="left">
  657. <table cellspacing="4" cellpadding="0" border="0">
  658. <tr>
  659. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  660. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  661. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  662. </tr>
  663. <tr>
  664. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  665. <td bgcolor="#ffffff"><pre>
  666. &lt;!-- Specify the build.dir in the main project prior to the reference
  667. being created --&gt;
  668. &lt;property name=&quot;main:build.dir&quot; value=&quot;build/main&quot;/&gt;
  669. &lt;!-- create the reference to the main build --&gt;
  670. &lt;ref project=&quot;main.xml&quot; name=&quot;main&quot;/&gt;
  671. &lt;!-- create the reference to the test build --&gt;
  672. &lt;ref project=&quot;test.xml&quot; name=&quot;test&quot;&gt;
  673. &lt;property name=&quot;build.dir&quot; value=&quot;build/test&quot;/&gt;
  674. &lt;/ref&gt;
  675. &lt;!-- our main target calls the fubar target in the main build --&gt;
  676. &lt;target name=&quot;main&quot;&gt;
  677. &lt;antcall target=&quot;main:fubar&quot;/&gt;
  678. &lt;/target&gt;
  679. &lt;!-- Our alt target depends on the fubar target in the main build --&gt;
  680. &lt;target name=&quot;alt&quot; depends=&quot;main:fubar&quot;&gt;
  681. &lt;echo message=&quot;main's debug flag is ${main:debug}&quot;/&gt;
  682. &lt;/target&gt;
  683. </pre></td>
  684. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  685. </tr>
  686. <tr>
  687. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  688. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  689. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  690. </tr>
  691. </table>
  692. </div>
  693. <p>
  694. When a project is referenced, the top level tasks of the referenced project are
  695. run to allow the project to initialize itself. Mutant allows the referring
  696. build to set a property in a referenced project before the reference is
  697. created. When the reference is eventually created these properties are set
  698. before initialization occurs. In normal Ant fashion, these overriding
  699. properties take precedence. In particular properties in the referenced projects
  700. may be set from the command line as this example shows
  701. </p>
  702. <div align="left">
  703. <table cellspacing="4" cellpadding="0" border="0">
  704. <tr>
  705. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  706. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  707. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  708. </tr>
  709. <tr>
  710. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  711. <td bgcolor="#ffffff"><pre>
  712. mutant -Dmain:build.dir=temp
  713. </pre></td>
  714. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  715. </tr>
  716. <tr>
  717. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  718. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  719. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  720. </tr>
  721. </table>
  722. </div>
  723. <p>
  724. The example above shows a target in the referenced project being used as a
  725. dependency and also as a target in an antcall. Since refs are dynamic, Mutant
  726. will only evaluate such dependencies when required. If the alt target were
  727. never to be run, the dependency on main:fubar would never be checked.
  728. </p>
  729. <p>
  730. The import task allows components defined in a referenced project to be brought
  731. into the main build. For example, the following will bring the definition of
  732. tool from the test project in the build. The imported component may also be
  733. aliased to a new name.
  734. </p>
  735. <div align="left">
  736. <table cellspacing="4" cellpadding="0" border="0">
  737. <tr>
  738. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  739. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  740. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  741. </tr>
  742. <tr>
  743. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  744. <td bgcolor="#ffffff"><pre>
  745. &lt;!-- import a task definition from another project --&gt;
  746. &lt;import ref=&quot;test:tool&quot;/&gt;
  747. </pre></td>
  748. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  749. </tr>
  750. <tr>
  751. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  752. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  753. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  754. </tr>
  755. </table>
  756. </div>
  757. </blockquote>
  758. </td></tr>
  759. </table>
  760. </blockquote>
  761. </td></tr>
  762. </table>
  763. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  764. <tr><td bgcolor="#525D76">
  765. <font color="#ffffff" face="arial,helvetica,sanserif">
  766. <a name="Configuration"><strong>Configuration</strong></a>
  767. </font>
  768. </td></tr>
  769. <tr><td>
  770. <blockquote>
  771. <p>
  772. As discussed above Mutant provides a number of tasks to manage libraries and
  773. it is appropriate to run many of these tasks as part of a user or system-wide
  774. configuration rather than incorporating them into the build file. Mutant
  775. provides a configuration system to support running these tasks at an appropriate
  776. time. A Mutant configuration file looks as follows
  777. </p>
  778. <div align="left">
  779. <table cellspacing="4" cellpadding="0" border="0">
  780. <tr>
  781. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  782. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  783. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  784. </tr>
  785. <tr>
  786. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  787. <td bgcolor="#ffffff"><pre>
  788. &lt;antconfig allow-unset-properties=&quot;true&quot;&gt;
  789. &lt;global-tasks&gt;
  790. &lt;libpath libraryid=&quot;ant.ant1compat&quot;
  791. file=&quot;/home/conor/dev/jakarta-ant/lib/optional/&quot;/&gt;
  792. &lt;/global-tasks&gt;
  793. &lt;project-tasks&gt;
  794. &lt;import libraryid=&quot;antopt.monitor&quot;/&gt;
  795. &lt;/project-tasks&gt;
  796. &lt;/antconfig&gt;
  797. </pre></td>
  798. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  799. </tr>
  800. <tr>
  801. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  802. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  803. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  804. </tr>
  805. </table>
  806. </div>
  807. <p>
  808. The antconfig element is the root element of the configuration file. It supports
  809. three attributes
  810. </p>
  811. <table>
  812. <tr>
  813. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  814. valign="top" align="left">
  815. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  816. allow-unset-properties
  817. </font>
  818. </td>
  819. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  820. valign="top" align="left">
  821. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  822. controls whether Mutant will fail a build which
  823. refers to a property which has not been set. This defaults to the Ant1 behaviour
  824. (true)
  825. </font>
  826. </td>
  827. </tr>
  828. <tr>
  829. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  830. valign="top" align="left">
  831. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  832. allow-remote-library
  833. </font>
  834. </td>
  835. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  836. valign="top" align="left">
  837. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  838. controls whether Mutant uses components defined in remote libraries
  839. </font>
  840. </td>
  841. </tr>
  842. <tr>
  843. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  844. valign="top" align="left">
  845. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  846. allow-remote-project
  847. </font>
  848. </td>
  849. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  850. valign="top" align="left">
  851. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  852. controls whether Mutant can run a project or reference a project which is
  853. located remotely.
  854. </font>
  855. </td>
  856. </tr>
  857. </table>
  858. <p>
  859. The configuration provides two collections of configuration tasks, global-tasks
  860. and project-tasks. Global-tasks are run once and are run in the context of the
  861. main project - i.e. the build file identified on the command line (defaults to
  862. build.xml/build.ant), whilst project-tasks are run as part of the initialization
  863. of every project including referenced projects and antcall projects. Looking at
  864. the above example, the global-tasks associate a path with the ant.ant1compat
  865. library while the per-project tasks import the antopt.monitor library into every
  866. project that Mutant processes.
  867. </p>
  868. <p>
  869. The tasks that can be run in the configuration phase are regular tasks but not
  870. all tasks are automatically available. This is the difference between the
  871. syslibs and antlibs directories. The global tasks are run after the syslibs
  872. libraries have been loaded but prior to the antlibs libraries being loaded. The
  873. syslibs library tasks are therefore available in the configuration phase. This
  874. arrangement is to allow the configuration tasks to setup library paths for the
  875. libraries contained in the antlibs directory, especially libraries in the Ant
  876. namespace which are automatically imported at the time they are loaded.
  877. </p>
  878. <p>
  879. If it is required to use tasks from libraries installed in the antlibs
  880. directory, the configuration tasks may explicitly load the library and import
  881. the required tasks. The following example shows the loading and use of the echo
  882. task in the configuration tasks. Note that the ant.home property has been set at
  883. the time the configuration tasks are started.
  884. </p>
  885. <div align="left">
  886. <table cellspacing="4" cellpadding="0" border="0">
  887. <tr>
  888. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  889. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  890. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  891. </tr>
  892. <tr>
  893. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  894. <td bgcolor="#ffffff"><pre>
  895. &lt;antconfig allow-unset-properties=&quot;true&quot;&gt;
  896. &lt;global-tasks&gt;
  897. &lt;loadlib file=&quot;${ant.home}/lib/antlibs/ant1compat.jar&quot; importall=&quot;true&quot;/&gt;
  898. &lt;echo message=&quot;Starting the build&quot;/&gt;
  899. &lt;/global-tasks&gt;
  900. &lt;project-tasks&gt;
  901. &lt;echo message=&quot;Starting new project&quot;/&gt;
  902. &lt;/project-tasks&gt;
  903. &lt;/antconfig&gt;
  904. </pre></td>
  905. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  906. </tr>
  907. <tr>
  908. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  909. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  910. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  911. </tr>
  912. </table>
  913. </div>
  914. <p>
  915. When Mutant starts up it will load configurations from two locations - The file
  916. .ant/conf/antconfig.xml in the user's home directory and the file
  917. conf/antconfig.xml in the Mutant home directory. In addition, config files can
  918. be specified on the command line using a -config argument. This allows project
  919. specific configurations to be used.
  920. </p>
  921. </blockquote>
  922. </td></tr>
  923. </table>
  924. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  925. <tr><td bgcolor="#525D76">
  926. <font color="#ffffff" face="arial,helvetica,sanserif">
  927. <a name="Targetless builds"><strong>Targetless builds</strong></a>
  928. </font>
  929. </td></tr>
  930. <tr><td>
  931. <blockquote>
  932. <p>
  933. Mutant allows any task or datatype to be placed outside of a target. All such
  934. components are processed when the project is initialized and before any targets
  935. are processed. In fact Mutant does not require that a project contain any
  936. targets. In this case the only operations performed are the top level tasks at
  937. project initialization. The following shows a simple example
  938. </p>
  939. <div align="left">
  940. <table cellspacing="4" cellpadding="0" border="0">
  941. <tr>
  942. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  943. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  944. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  945. </tr>
  946. <tr>
  947. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  948. <td bgcolor="#ffffff"><pre>
  949. &lt;project&gt;
  950. &lt;echo message=&quot;Welcome to Mutant&quot;/&gt;
  951. &lt;/project&gt;
  952. </pre></td>
  953. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  954. </tr>
  955. <tr>
  956. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  957. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  958. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  959. </tr>
  960. </table>
  961. </div>
  962. </blockquote>
  963. </td></tr>
  964. </table>
  965. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  966. <tr><td bgcolor="#525D76">
  967. <font color="#ffffff" face="arial,helvetica,sanserif">
  968. <a name="Extensibility"><strong>Extensibility</strong></a>
  969. </font>
  970. </td></tr>
  971. <tr><td>
  972. <blockquote>
  973. <p>
  974. Normally when a task supports a nested element, Ant automatically determines the
  975. type of the nested element and creates an instance of this type. This instance is
  976. then configured and passed to the task. Mutant extends this scheme by allowing
  977. a build file writer to specify the type of nested element to use rather than
  978. relying on the core to determine it. Mutant will process attributes and further
  979. nested elements based on the specified type. For example:
  980. </p>
  981. <div align="left">
  982. <table cellspacing="4" cellpadding="0" border="0">
  983. <tr>
  984. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  985. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  986. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  987. </tr>
  988. <tr>
  989. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  990. <td bgcolor="#ffffff"><pre>
  991. &lt;copy todir=&quot;dest&quot;&gt;
  992. &lt;fileset xsi:type=&quot;classfileset&quot; dir=&quot;../../bin/ant1compat/&quot;&gt;
  993. &lt;root classname=&quot;org.apache.tools.ant.Project&quot;/&gt;
  994. &lt;/fileset&gt;
  995. &lt;/copy&gt;
  996. </pre></td>
  997. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  998. </tr>
  999. <tr>
  1000. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1001. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1002. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1003. </tr>
  1004. </table>
  1005. </div>
  1006. <p>
  1007. In this example the nested element is actually a classfileset which supports the
  1008. &lt;root&gt; nested element. The actual type is specified using the notation from
  1009. XML Schema. Mutant predclares the XML Schema namespace under the xsi prefix. You
  1010. may explicitly declare this in the build file's XML and use a different prefix
  1011. if you wish. For example, this is equivalent to the above
  1012. </p>
  1013. <div align="left">
  1014. <table cellspacing="4" cellpadding="0" border="0">
  1015. <tr>
  1016. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1017. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1018. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1019. </tr>
  1020. <tr>
  1021. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1022. <td bgcolor="#ffffff"><pre>
  1023. &lt;?xml version=&quot;1.0&quot;?&gt;
  1024. &lt;project xmlns:schema=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  1025. name=&quot;test&quot; default=&quot;main&quot;&gt;
  1026. &lt;target name=&quot;main&quot;&gt;
  1027. &lt;delete dir=&quot;dest&quot;/&gt;
  1028. &lt;mkdir dir=&quot;dest&quot;/&gt;
  1029. &lt;copy todir=&quot;dest&quot;&gt;
  1030. &lt;fileset schema:type=&quot;classfileset&quot; dir=&quot;../../bin/ant1compat/&quot;&gt;
  1031. &lt;root classname=&quot;org.apache.tools.ant.Project&quot;/&gt;
  1032. &lt;/fileset&gt;
  1033. &lt;/copy&gt;
  1034. &lt;/target&gt;
  1035. &lt;/project&gt;
  1036. </pre></td>
  1037. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1038. </tr>
  1039. <tr>
  1040. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1041. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1042. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1043. </tr>
  1044. </table>
  1045. </div>
  1046. </blockquote>
  1047. </td></tr>
  1048. </table>
  1049. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1050. <tr><td bgcolor="#525D76">
  1051. <font color="#ffffff" face="arial,helvetica,sanserif">
  1052. <a name="Default build file"><strong>Default build file</strong></a>
  1053. </font>
  1054. </td></tr>
  1055. <tr><td>
  1056. <blockquote>
  1057. <p>In Ant1, the default build file name is build.xml. In Mutant, the default
  1058. build file is build.ant. If build.xnt cannot be found, Mutant will then look for
  1059. build.xml. This allows you to support both Ant1 and Ant2 users. The build.xml
  1060. file can contain an Ant1 build file. The build.ant file can include or reference
  1061. this build and make use of Mutant's capabilities such as library management,
  1062. library path settings, etc.
  1063. </p>
  1064. </blockquote>
  1065. </td></tr>
  1066. </table>
  1067. </td>
  1068. </tr>
  1069. <!-- FOOTER -->
  1070. <tr><td colspan="2">
  1071. <hr noshade="" size="1"/>
  1072. </td></tr>
  1073. <tr><td colspan="2">
  1074. <div align="center"><font color="#525D76" size="-1"><em>
  1075. Copyright &#169; 2002, Apache Software Foundation
  1076. </em></font></div>
  1077. </td></tr>
  1078. </table>
  1079. </body>
  1080. </html>
  1081. <!-- end the processing -->