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 9.6 kB

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