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.

ant-update.xsl 5.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  2. <xsl:output method="xml" indent="yes"/>
  3. <!--
  4. The Apache Software License, Version 1.1
  5. Copyright (c) 2001-2002 The Apache Software Foundation. All rights
  6. reserved.
  7. Redistribution and use in source and binary forms, with or without
  8. modification, are permitted provided that the following conditions
  9. are met:
  10. 1. Redistributions of source code must retain the above copyright
  11. notice, this list of conditions and the following disclaimer.
  12. 2. Redistributions in binary form must reproduce the above copyright
  13. notice, this list of conditions and the following disclaimer in
  14. the documentation and/or other materials provided with the
  15. distribution.
  16. 3. The end-user documentation included with the redistribution, if
  17. any, must include the following acknowlegement:
  18. "This product includes software developed by the
  19. Apache Software Foundation (http://www.apache.org/)."
  20. Alternately, this acknowlegement may appear in the software itself,
  21. if and wherever such third-party acknowlegements normally appear.
  22. 4. The names "Ant" and "Apache Software
  23. Foundation" must not be used to endorse or promote products derived
  24. from this software without prior written permission. For written
  25. permission, please contact apache@apache.org.
  26. 5. Products derived from this software may not be called "Apache"
  27. nor may "Apache" appear in their names without prior written
  28. permission of the Apache Group.
  29. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  30. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  31. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  32. DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  33. ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  36. USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  37. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  38. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  39. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  40. SUCH DAMAGE.
  41. ====================================================================
  42. This software consists of voluntary contributions made by many
  43. individuals on behalf of the Apache Software Foundation. For more
  44. information on the Apache Software Foundation, please see
  45. <http://www.apache.org/>.
  46. -->
  47. <!--
  48. The purpose have this XSL is to provide a fast way to update a buildfile
  49. from deprecated tasks.
  50. It should particulary be useful when there is a lot of build files to migrate.
  51. If you do not want to migrate to a particular task and want to keep it for
  52. various reason, just comment the appropriate template.
  53. !!!! Use at your own risk. !!!!
  54. @author <a href="sbailliez@apache.org">Stephane Bailliez</a>
  55. -->
  56. <!-- (zip|jar|war|ear)file attributes are replaced by destfile in their respective task -->
  57. <xsl:template match="zip">
  58. <zip destfile="{@zipfile}">
  59. <xsl:apply-templates select="@*[not(name()='zipfile')]|node()"/>
  60. </zip>
  61. </xsl:template>
  62. <xsl:template match="jar">
  63. <jar destfile="{@jarfile}">
  64. <xsl:apply-templates select="@*[not(name()='jarfile')]|node()"/>
  65. </jar>
  66. </xsl:template>
  67. <xsl:template match="war">
  68. <war destfile="{@warfile}">
  69. <xsl:apply-templates select="@*[not(name()='warfile')]|node()"/>
  70. </war>
  71. </xsl:template>
  72. <xsl:template match="ear">
  73. <ear destfile="{@earfile}">
  74. <xsl:apply-templates select="@*[not(name()='earfile')]|node()"/>
  75. </ear>
  76. </xsl:template>
  77. <!-- copydir is replaced by copy -->
  78. <xsl:template match="copydir">
  79. <copy todir="{@dest}">
  80. <xsl:apply-templates select="@flatten|@filtering"/>
  81. <xsl:if test="@forceoverwrite">
  82. <xsl:attribute name="overwrite"><xsl:value-of select="@forceoverwrite"/></xsl:attribute>
  83. </xsl:if>
  84. <fileset dir="{@src}">
  85. <xsl:apply-templates select="@includes|@includesfile|@excludes|@excludesfile|node()"/>
  86. </fileset>
  87. </copy>
  88. </xsl:template>
  89. <!-- copyfile is replaced by copy -->
  90. <xsl:template match="copyfile">
  91. <copy file="{@src}" tofile="{@dest}">
  92. <xsl:apply-templates select="@filtering"/>
  93. <xsl:if test="@forceoverwrite">
  94. <xsl:attribute name="overwrite"><xsl:value-of select="@forceoverwrite"/></xsl:attribute>
  95. </xsl:if>
  96. </copy>
  97. </xsl:template>
  98. <!-- deltree is replaced by delete -->
  99. <xsl:template match="deltree">
  100. <delete dir="{@dir}"/>
  101. </xsl:template>
  102. <!-- execon is replaced by apply -->
  103. <xsl:template match="execon">
  104. <apply>
  105. <xsl:apply-templates select="@*|node()"/>
  106. </apply>
  107. </xsl:template>
  108. <!-- rename is replaced by move -->
  109. <xsl:template match="rename">
  110. <move file="{@src}" tofile="{@dest}">
  111. <xsl:if test="@replace">
  112. <xsl:attribute name="overwrite"><xsl:value-of select="@replace"/></xsl:attribute>
  113. </xsl:if>
  114. </move>
  115. </xsl:template>
  116. <!-- javadoc2 is replaced by javadoc -->
  117. <xsl:template match="javadoc2">
  118. <javadoc>
  119. <xsl:apply-templates select="@*|node()"/>
  120. </javadoc>
  121. </xsl:template>
  122. <!-- Copy every node and attributes recursively -->
  123. <xsl:template match="node()|@*">
  124. <xsl:copy>
  125. <xsl:apply-templates select="@*|node()"/>
  126. </xsl:copy>
  127. </xsl:template>
  128. </xsl:stylesheet>