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.

ant1compat.html 10 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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="Darrell DeBoer">
  8. <meta name="email" value="darrell at apache dot org">
  9. <title>Apache Myrmidon - Ant 1 Compatibitlity Layer</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> <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. </td>
  19. <td valign="bottom"><div align="right"><b><font size="+3" color="#525D76">Apache Myrmidon</font></b></div></td>
  20. </tr>
  21. </table>
  22. <table border="0" width="100%" cellspacing="4">
  23. <tr><td colspan="2">
  24. <hr noshade="" size="1"/>
  25. </td></tr>
  26. <tr>
  27. <!-- LEFT SIDE NAVIGATION -->
  28. <td valign="top" nowrap="true">
  29. <p><strong>Myrmidon</strong></p>
  30. <ul>
  31. <li> <a href="./index.html">Introduction</a>
  32. </li>
  33. <li> <a href="./getinvolved.html">Get Involved</a>
  34. </li>
  35. <li> <a href="./user.html">Building Myrmidon</a>
  36. </li>
  37. <li> <a href="./todo.html">Todo List</a>
  38. </li>
  39. </ul>
  40. <p><strong>User Guide</strong></p>
  41. <ul>
  42. <li> <a href="./buildfile.html">Project File</a>
  43. </li>
  44. <li> <a href="./vfs.html">Virtual File System</a>
  45. </li>
  46. <li> <a href="./ant1compat.html">Ant 1 Compatibility Layer</a>
  47. </li>
  48. <li> <a href="./differences.html">Differences to Ant 1</a>
  49. </li>
  50. <li> <a href="./task.html">My First Task</a>
  51. </li>
  52. </ul>
  53. <p><strong>Extending Ant</strong></p>
  54. <ul>
  55. <li> <a href="./configuring.html">Configuration HOWTO</a>
  56. </li>
  57. <li> <a href="./converter.html">Converter HOWTO</a>
  58. </li>
  59. <li> <a href="./type.html">Type HOWTO</a>
  60. </li>
  61. <li> <a href="./classloader.html">ClassLoader HOWTO</a>
  62. </li>
  63. <li> <a href="./librarys.html">Library HOWTO</a>
  64. </li>
  65. </ul>
  66. <p><strong>Container Design</strong></p>
  67. <ul>
  68. </ul>
  69. </td>
  70. <td align="left" valign="top">
  71. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  72. <tr><td bgcolor="#525D76">
  73. <font color="#ffffff" face="arial,helvetica,sanserif">
  74. <a name="Overview"><strong>Overview</strong></a>
  75. </font>
  76. </td></tr>
  77. <tr><td>
  78. <blockquote>
  79. <p>
  80. The Myrmidon-Ant1 Compatibility layer works by reusing most of the Ant 1 code,
  81. with tasks and datatypes
  82. being prefixed with "ant1." in build files. Almost all of the main Ant 1 tree
  83. is included in the compatibility layer antlib. To insulate from changes in
  84. the Ant 1 tree, Ant 1 class files are extracted from a jar, rather than
  85. being compiled from scratch.
  86. </p>
  87. <p>
  88. Here's how it works: The first time an Ant 1 task is encountered, an Ant 1
  89. project is created, and stored in the TaskContext under the name "ant1.project".
  90. The Ant 1 versions of Task and Project have been extended, overriding core behaviour,
  91. with Myrmidon-specific behaviour.
  92. </p>
  93. <p>
  94. The updated version of Task implements Configurable, receiving it's
  95. complete Task Model, and actually setting/adding/creating attributes
  96. with the help of the IntrospectionHelper. This process is designed to
  97. mimic the Ant 1 configuration policy, although not <i>all</i> of the
  98. subtle variations of configuration present in Ant 1 are handled.
  99. </p>
  100. <p>
  101. The updated version of Project will provide hooks into the Myrmidon TaskContext,
  102. such as:</p>
  103. <ul>
  104. <li>logging (done)</li>
  105. <li>properties (done)</li>
  106. <li>references (not yet done)</li>
  107. <li>Task defined by &lt;taskdef&gt; (done)</li>
  108. </ul>
  109. <p>
  110. So at present, properties declared in Ant 2 tasks are available to all Ant 1 tasks,
  111. and vice-versa. However, while a <code>&lt;ant1.path&gt;</code> reference works fine
  112. in other <code>&lt;ant1.XXX&gt;</code>
  113. tasks, it's not visible to Ant 2 tasks in the same build, and vice-versa.
  114. </p>
  115. <p>
  116. The <code>&lt;taskdef&gt;</code> task works ok, registering the task with the TypeManager using the
  117. "ant1." prefix. Only a couple of DataTypes (Path and Patternset) are working
  118. as top-level types, but this should be just a matter of adding references to
  119. the Ant 1 version of TypeInstanceTask in the descriptor.
  120. </p>
  121. <p>
  122. The TransformingProjectBuilder (which is now the default builder for files
  123. of type ".xml", applies a transformation stylesheet to the file, prefixing select
  124. tasks (all at present) with "ant.". If a version attribute is encountered, the
  125. file is not transformed
  126. </p>
  127. </blockquote>
  128. </td></tr>
  129. </table>
  130. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  131. <tr><td bgcolor="#525D76">
  132. <font color="#ffffff" face="arial,helvetica,sanserif">
  133. <a name="Using the compatibility layer"><strong>Using the compatibility layer</strong></a>
  134. </font>
  135. </td></tr>
  136. <tr><td>
  137. <blockquote>
  138. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  139. <tr><td bgcolor="#828DA6">
  140. <font color="#ffffff" face="arial,helvetica,sanserif">
  141. <a name="Using Ant 1 tasks in a Myrmidon build file"><strong>Using Ant 1 tasks in a Myrmidon build file</strong></a>
  142. </font>
  143. </td></tr>
  144. <tr><td>
  145. <blockquote>
  146. <p>
  147. If you have a Myrmidon build file (eg with <code>version="2.0"</code>
  148. on the project element, you can use Ant 1 tasks and datatypes by using
  149. the "ant1." suffix on the regular element name.
  150. Virtually <i>all</i> tasks and datatypes from Ant 1.4.1 are available
  151. in this way.
  152. </p>
  153. <p>
  154. When declaring a new task using the <code>&lt;ant1.taskdef&gt;</code>
  155. task, <i>don't</i> prepend "ant1." to the taskname. This will be
  156. done automatically by the taskdef task. However, you will need
  157. to use the "ant1." prefix in all uses of that task.
  158. </p>
  159. </blockquote>
  160. </td></tr>
  161. </table>
  162. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  163. <tr><td bgcolor="#828DA6">
  164. <font color="#ffffff" face="arial,helvetica,sanserif">
  165. <a name="Using an existing Ant 1 build file"><strong>Using an existing Ant 1 build file</strong></a>
  166. </font>
  167. </td></tr>
  168. <tr><td>
  169. <blockquote>
  170. <p>
  171. Myrmidon will automatically handle Ant 1 build files using the
  172. Ant 1 Compatibility layer. So, using an Ant 1 build
  173. file with Myrmidon should be as simple as:</p>
  174. <pre>[myrmidon-command] -f ant1-build-file.xml</pre>
  175. <p>
  176. This works as follows: When Myrmidon encounters a ".xml" build file which does not have a
  177. <code>version</code> attribute on the top-level <code>project</code>
  178. element, it assumes that it is an Ant 1 build file. So all tasks are
  179. interpreted as though they are prefixed with the "ant." name prefix.
  180. </p>
  181. </blockquote>
  182. </td></tr>
  183. </table>
  184. </blockquote>
  185. </td></tr>
  186. </table>
  187. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  188. <tr><td bgcolor="#525D76">
  189. <font color="#ffffff" face="arial,helvetica,sanserif">
  190. <a name="Building the compatibility layer"><strong>Building the compatibility layer</strong></a>
  191. </font>
  192. </td></tr>
  193. <tr><td>
  194. <blockquote>
  195. <p>Before building the Ant 1 Compatibility layer, you need to build
  196. Myrmidon, running the <code>dist-lite</code> target of the main build.
  197. See <a href="user.html#Building Myrmidon">the build instructions</a>
  198. for more details.</p>
  199. <p>To build the compatibility layer, simply execute:</p>
  200. <pre>ant -f ant1compat.xml</pre>
  201. <p>from within the root directory of the Myrmidon source tree.</p>
  202. </blockquote>
  203. </td></tr>
  204. </table>
  205. </td>
  206. </tr>
  207. <!-- FOOTER -->
  208. <tr><td colspan="2">
  209. <hr noshade="" size="1"/>
  210. </td></tr>
  211. <tr><td colspan="2">
  212. <div align="center"><font color="#525D76" size="-1"><em>
  213. Copyright &#169; 2000-2002, Apache Software Foundation
  214. </em></font></div>
  215. </td></tr>
  216. </table>
  217. </body>
  218. </html>
  219. <!-- end the processing -->