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.

bootstrap.xsl 7.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  2. <xsl:strip-space elements="*"/>
  3. <xsl:output method="text" omit-xml-declaration="yes"/>
  4. <xsl:template match="project">
  5. <xsl:text>package org.apache.ant.builder;&#10;</xsl:text>
  6. <xsl:text>public class </xsl:text>
  7. <xsl:value-of select="attribute::name"/>
  8. <xsl:text>Builder {&#10;</xsl:text>
  9. <xsl:text> protected void _init(BuildHelper helper) {&#10;</xsl:text>
  10. <xsl:apply-templates select="property"/>
  11. <xsl:apply-templates select="path"/>
  12. <xsl:text> }&#10;</xsl:text>
  13. <xsl:apply-templates select="target"/>
  14. <xsl:text>}&#10;</xsl:text>
  15. </xsl:template>
  16. <xsl:template match="property">
  17. <xsl:text> helper.setProperty(&quot;</xsl:text>
  18. <xsl:value-of select="attribute::name"/>
  19. <xsl:text>&quot;, &quot;</xsl:text>
  20. <xsl:value-of select="attribute::value"/>
  21. <xsl:text>&quot;);&#10;</xsl:text>
  22. </xsl:template>
  23. <xsl:template match="antcall">
  24. <xsl:text> {&#10;</xsl:text>
  25. <xsl:text> BuildHelper subHelper = new BuildHelper();&#10;</xsl:text>
  26. <xsl:for-each select="param">
  27. <xsl:text> subHelper.setProperty(&quot;</xsl:text>
  28. <xsl:value-of select="attribute::name"/>
  29. <xsl:text>&quot;, helper.resolve(&quot;</xsl:text>
  30. <xsl:value-of select="attribute::value"/>
  31. <xsl:text>&quot;));&#10;</xsl:text>
  32. </xsl:for-each>
  33. <xsl:text> subHelper.setParent(helper);&#10;</xsl:text>
  34. <xsl:text> _init(subHelper);&#10;</xsl:text>
  35. <xsl:text> </xsl:text>
  36. <xsl:value-of select="attribute::target"/>
  37. <xsl:text>(subHelper);&#10;</xsl:text>
  38. <xsl:text> }&#10;</xsl:text>
  39. </xsl:template>
  40. <xsl:template match="echo">
  41. </xsl:template>
  42. <xsl:template match="path">
  43. <xsl:text> helper.createPath(&quot;</xsl:text>
  44. <xsl:variable name="pathName" select="attribute::id"/>
  45. <xsl:value-of select="$pathName"/>
  46. <xsl:text>&quot;);&#10;</xsl:text>
  47. <xsl:for-each select="fileset">
  48. <xsl:text> </xsl:text>
  49. <xsl:text>helper.addFileSetToPath(&quot;</xsl:text>
  50. <xsl:value-of select="$pathName"/>
  51. <xsl:text>&quot;, &#10;</xsl:text>
  52. <xsl:text> &quot;</xsl:text>
  53. <xsl:value-of select="attribute::dir"/>
  54. <xsl:text>&quot;, </xsl:text>
  55. <xsl:choose>
  56. <xsl:when test="attribute::includes">
  57. <xsl:text>&quot;</xsl:text>
  58. <xsl:value-of select="attribute::includes"/>
  59. <xsl:text>&quot;</xsl:text>
  60. </xsl:when>
  61. <xsl:otherwise>
  62. <xsl:text>null</xsl:text>
  63. </xsl:otherwise>
  64. </xsl:choose>
  65. <xsl:text>);&#10;</xsl:text>
  66. </xsl:for-each>
  67. <xsl:for-each select="pathelement">
  68. <xsl:text> </xsl:text>
  69. <xsl:text>helper.addPathElementToPath(&quot;</xsl:text>
  70. <xsl:value-of select="$pathName"/>
  71. <xsl:text>&quot;, &quot;</xsl:text>
  72. <xsl:value-of select="attribute::location"/>
  73. <xsl:text>&quot;);&#10;</xsl:text>
  74. </xsl:for-each>
  75. <xsl:for-each select="path">
  76. <xsl:text> </xsl:text>
  77. <xsl:text>helper.addPathToPath(&quot;</xsl:text>
  78. <xsl:value-of select="$pathName"/>
  79. <xsl:text>&quot;, &quot;</xsl:text>
  80. <xsl:value-of select="attribute::refid"/>
  81. <xsl:text>&quot;);&#10;</xsl:text>
  82. </xsl:for-each>
  83. </xsl:template>
  84. <xsl:template match="target">
  85. <xsl:text> protected void </xsl:text>
  86. <xsl:value-of select="translate(attribute::name, '-', '_')"/>
  87. <xsl:text>(BuildHelper helper) {&#10;</xsl:text>
  88. <xsl:text> helper.runDepends(this, &quot;</xsl:text>
  89. <xsl:value-of select="translate(attribute::name, '-', '_')"/>
  90. <xsl:text>&quot;, &quot;</xsl:text>
  91. <xsl:value-of select="translate(attribute::depends, '-', '_')"/>
  92. <xsl:text>&quot;);&#10;</xsl:text>
  93. <xsl:text> System.out.println(&quot;</xsl:text>
  94. <xsl:value-of select="attribute::name"/>
  95. <xsl:text>: &quot;);&#10;</xsl:text>
  96. <xsl:apply-templates/>
  97. <xsl:text> }&#10;</xsl:text>
  98. </xsl:template>
  99. <xsl:template match="mkdir">
  100. <xsl:text> helper.mkdir(&quot;</xsl:text>
  101. <xsl:value-of select="attribute::dir"/>
  102. <xsl:text>&quot;);&#10;</xsl:text>
  103. </xsl:template>
  104. <xsl:template match="javac">
  105. <xsl:text> helper.javac(&quot;</xsl:text>
  106. <xsl:value-of select="attribute::srcdir"/>
  107. <xsl:text>&quot;, &quot;</xsl:text>
  108. <xsl:value-of select="attribute::destdir"/>
  109. <xsl:text>&quot;, </xsl:text>
  110. <xsl:choose>
  111. <xsl:when test="classpath">
  112. <xsl:text>&quot;</xsl:text>
  113. <xsl:value-of select="classpath/attribute::refid"/>
  114. <xsl:text>&quot;</xsl:text>
  115. </xsl:when>
  116. <xsl:otherwise>
  117. <xsl:text>null</xsl:text>
  118. </xsl:otherwise>
  119. </xsl:choose>
  120. <xsl:text>);&#10;</xsl:text>
  121. </xsl:template>
  122. <xsl:template match="jar">
  123. <xsl:text> helper.jar(&quot;</xsl:text>
  124. <xsl:value-of select="attribute::basedir"/>
  125. <xsl:text>&quot;, &quot;</xsl:text>
  126. <xsl:value-of select="attribute::jarfile"/>
  127. <xsl:text>&quot;,&#10; </xsl:text>
  128. <xsl:choose>
  129. <xsl:when test="metainf">
  130. <xsl:text>&quot;</xsl:text>
  131. <xsl:value-of select="metainf/attribute::dir"/>
  132. <xsl:text>&quot;, </xsl:text>
  133. <xsl:choose>
  134. <xsl:when test="metainf/attribute::includes">
  135. <xsl:text>&quot;</xsl:text>
  136. <xsl:value-of select="metainf/attribute::includes"/>
  137. <xsl:text>&quot;, </xsl:text>
  138. </xsl:when>
  139. <xsl:otherwise>
  140. <xsl:text>null, </xsl:text>
  141. </xsl:otherwise>
  142. </xsl:choose>
  143. </xsl:when>
  144. <xsl:otherwise>
  145. <xsl:text>null, null, </xsl:text>
  146. </xsl:otherwise>
  147. </xsl:choose>
  148. <xsl:choose>
  149. <xsl:when test="manifest/attribute[attribute::name='Class-Path']">
  150. <xsl:text>&quot;</xsl:text>
  151. <xsl:value-of select="manifest/attribute[attribute::name='Class-Path']/attribute::value"/>
  152. <xsl:text>&quot;, </xsl:text>
  153. </xsl:when>
  154. <xsl:otherwise>null, </xsl:otherwise>
  155. </xsl:choose>
  156. <xsl:choose>
  157. <xsl:when test="manifest/attribute[attribute::name='Main-Class']">
  158. <xsl:text>&quot;</xsl:text>
  159. <xsl:value-of select="manifest/attribute[attribute::name='Main-Class']/attribute::value"/>
  160. <xsl:text>&quot;</xsl:text>
  161. </xsl:when>
  162. <xsl:otherwise>null</xsl:otherwise>
  163. </xsl:choose>
  164. <xsl:text>);&#10;</xsl:text>
  165. </xsl:template>
  166. <xsl:template match="copy/fileset">
  167. <xsl:choose>
  168. <xsl:when test="attribute::refid">
  169. <xsl:text> helper.copyFilesetRef(&quot;</xsl:text>
  170. <xsl:value-of select="attribute::refid"/>
  171. <xsl:text>&quot;, &quot;</xsl:text>
  172. <xsl:value-of select="../attribute::todir"/>
  173. <xsl:text>&quot;);&#10;</xsl:text>
  174. </xsl:when>
  175. <xsl:otherwise>
  176. <xsl:text> helper.copyFileset(&quot;</xsl:text>
  177. <xsl:value-of select="attribute::dir"/>
  178. <xsl:text>&quot;, &quot;</xsl:text>
  179. <xsl:value-of select="../attribute::todir"/>
  180. <xsl:text>&quot;);&#10;</xsl:text>
  181. </xsl:otherwise>
  182. </xsl:choose>
  183. </xsl:template>
  184. </xsl:stylesheet>