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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:output method="xml" indent="yes"/>
  4. <!--
  5. Licensed to the Apache Software Foundation (ASF) under one or more
  6. contributor license agreements. See the NOTICE file distributed with
  7. this work for additional information regarding copyright ownership.
  8. The ASF licenses this file to You under the Apache License, Version 2.0
  9. (the "License"); you may not use this file except in compliance with
  10. the License. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. -->
  18. <!--
  19. The purpose have this XSL is to provide a fast way to update a buildfile
  20. from deprecated tasks.
  21. It should particularly be useful when there is a lot of build files to migrate.
  22. If you do not want to migrate to a particular task and want to keep it for
  23. various reason, just comment the appropriate template.
  24. !!!! Use at your own risk. !!!!
  25. @author <a href="sbailliez@apache.org">Stephane Bailliez</a>
  26. -->
  27. <!-- (zip|jar|war|ear)file attributes are replaced by destfile in their respective task -->
  28. <xsl:template match="zip">
  29. <zip destfile="{@zipfile}">
  30. <xsl:apply-templates select="@*[not(name()='zipfile')]|node()"/>
  31. </zip>
  32. </xsl:template>
  33. <xsl:template match="jar">
  34. <jar destfile="{@jarfile}">
  35. <xsl:apply-templates select="@*[not(name()='jarfile')]|node()"/>
  36. </jar>
  37. </xsl:template>
  38. <xsl:template match="war">
  39. <war destfile="{@warfile}">
  40. <xsl:apply-templates select="@*[not(name()='warfile')]|node()"/>
  41. </war>
  42. </xsl:template>
  43. <xsl:template match="ear">
  44. <ear destfile="{@earfile}">
  45. <xsl:apply-templates select="@*[not(name()='earfile')]|node()"/>
  46. </ear>
  47. </xsl:template>
  48. <!-- copydir is replaced by copy -->
  49. <xsl:template match="copydir">
  50. <copy todir="{@dest}">
  51. <xsl:apply-templates select="@flatten|@filtering"/>
  52. <xsl:if test="@forceoverwrite">
  53. <xsl:attribute name="overwrite"><xsl:value-of select="@forceoverwrite"/></xsl:attribute>
  54. </xsl:if>
  55. <fileset dir="{@src}">
  56. <xsl:apply-templates select="@includes|@includesfile|@excludes|@excludesfile|node()"/>
  57. </fileset>
  58. </copy>
  59. </xsl:template>
  60. <!-- copyfile is replaced by copy -->
  61. <xsl:template match="copyfile">
  62. <copy file="{@src}" tofile="{@dest}">
  63. <xsl:apply-templates select="@filtering"/>
  64. <xsl:if test="@forceoverwrite">
  65. <xsl:attribute name="overwrite"><xsl:value-of select="@forceoverwrite"/></xsl:attribute>
  66. </xsl:if>
  67. </copy>
  68. </xsl:template>
  69. <!-- deltree is replaced by delete -->
  70. <xsl:template match="deltree">
  71. <delete dir="{@dir}"/>
  72. </xsl:template>
  73. <!-- execon is replaced by apply -->
  74. <xsl:template match="execon">
  75. <apply>
  76. <xsl:apply-templates select="@*|node()"/>
  77. </apply>
  78. </xsl:template>
  79. <!-- rename is replaced by move -->
  80. <xsl:template match="rename">
  81. <move file="{@src}" tofile="{@dest}">
  82. <xsl:if test="@replace">
  83. <xsl:attribute name="overwrite"><xsl:value-of select="@replace"/></xsl:attribute>
  84. </xsl:if>
  85. </move>
  86. </xsl:template>
  87. <!-- javadoc2 is replaced by javadoc -->
  88. <xsl:template match="javadoc2">
  89. <javadoc>
  90. <xsl:apply-templates select="@*|node()"/>
  91. </javadoc>
  92. </xsl:template>
  93. <!-- Copy every node and attributes recursively -->
  94. <xsl:template match="node()|@*">
  95. <xsl:copy>
  96. <xsl:apply-templates select="@*|node()"/>
  97. </xsl:copy>
  98. </xsl:template>
  99. </xsl:stylesheet>