ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/etc ant-update.xsl
Date Thu, 22 Nov 2001 21:23:06 GMT
sbailliez    01/11/22 13:23:06

  Added:       src/etc  ant-update.xsl
  Log:
  XSL that allows automatic update from deprecated tasks to non-deprecated tasks.
  At the moment it handles the following tasks:
  apply, javadoc2, deltree, copydir, copyfile, rename.
  Alternatively it handles the deprecation of the attributes jarfile and zipfile of jar
  and zip tasks that will be deprecated starting from Ant 1.5
  
  As suggested by Jose Alberto Fernandez <j_a_fernandez@yahoo.com>
  
  Revision  Changes    Path
  1.1                  jakarta-ant/src/etc/ant-update.xsl
  
  Index: ant-update.xsl
  ===================================================================
  <xsl:stylesheet	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" indent="yes"/>
  <!--
   The Apache Software License, Version 1.1
  
   Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   reserved.
  
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
  
   1. Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the
      distribution.
  
   3. The end-user documentation included with the redistribution, if
      any, must include the following acknowlegement:
         "This product includes software developed by the
          Apache Software Foundation (http://www.apache.org/)."
      Alternately, this acknowlegement may appear in the software itself,
      if and wherever such third-party acknowlegements normally appear.
  
   4. The names "The Jakarta Project", "Ant", and "Apache Software
      Foundation" must not be used to endorse or promote products derived
      from this software without prior written permission. For written
      permission, please contact apache@apache.org.
  
   5. Products derived from this software may not be called "Apache"
      nor may "Apache" appear in their names without prior written
      permission of the Apache Group.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   SUCH DAMAGE.
   ====================================================================
  
   This software consists of voluntary contributions made by many
   individuals on behalf of the Apache Software Foundation.  For more
   information on the Apache Software Foundation, please see
   <http://www.apache.org/>.
   -->
   
  <!--
  
    The purpose have this XSL is to provide a fast way to update a buildfile
    from deprecated tasks.
    
    It should particulary be useful when there is a lot of build files to migrate.
    If you do not want to migrate to a particular task and want to keep it for
    various reason, just comment the appropriate template.
    
    !!!! Use at your own risk. !!!!
    
    @author <a href="sbailliez@apache.org">Stephane Bailliez</a>
    
  -->
   
   
    <!-- jarfile and zipfile attributes are replaced by file in their respective task -->
    <xsl:template match="zip">
      <zip file="{@zipfile}">
        <xsl:apply-templates select="@*[not(name()='zipfile')]|node()"/>
      </zip>
    </xsl:template>
    <xsl:template match="jar">
      <jar file="{@jarfile}">
        <xsl:apply-templates select="@*[not(name()='jarfile')]|node()"/>
      </jar>
    </xsl:template>
     
   
    <!-- copydir is replaced by copy -->
    <xsl:template match="copydir">
      <copy todir="{@dest}">
        <xsl:apply-templates select="@flatten|@filtering"/>
        <xsl:if test="@forceoverwrite">
          <xsl:attribute name="overwrite"><xsl:value-of select="@forceoverwrite"/></xsl:attribute>
        </xsl:if>
        <fileset dir="{@src}">
            <xsl:apply-templates select="@includes|@includesfile|@excludes|excludesfile|node()"/>
        </fileset>
      </copy>
    </xsl:template>
  
    <!-- copyfile is replaced by copy -->
    <xsl:template match="copyfile">
      <copy file="{@src}" tofile="{@dest}">
        <xsl:apply-templates select="@filtering"/>
        <xsl:if test="@forceoverwrite">
          <xsl:attribute name="overwrite"><xsl:value-of select="@forceoverwrite"/></xsl:attribute>
        </xsl:if>
      </copy>
    </xsl:template>
  
    <!-- deltree is replaced by delete -->
    <xsl:template match="deltree">
      <delete dir="{@dir}"/>
    </xsl:template>
  
    <!-- execon is replaced by apply -->
    <xsl:template match="execon">
      <apply>
        <xsl:apply-templates select="@*|node()"/>
      </apply>
    </xsl:template>
  
    <!-- rename is replaced by move -->
    <xsl:template match="rename">
      <move file="{@src}" tofile="{@dest}">
        <xsl:if test="@replace">
          <xsl:attribute name="overwrite"><xsl:value-of select="@replace"/></xsl:attribute>
        </xsl:if>
      </move>
    </xsl:template>
  
    <!-- execon is replaced by apply -->
    <xsl:template match="javadoc2">
      <javadoc>
        <xsl:apply-templates select="@*|node()"/>
      </javadoc>
    </xsl:template>
  
  
    <!-- Copy every node and attributes recursively -->
    <xsl:template match="node()|@*">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
    
  </xsl:stylesheet>
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message