blob: f1ed219ad542e42808295e044e675e5e62308f79 [file] [log] [blame]
<?xml version="1.0"?>
<!--
=======================================================================
Use Apache Ant to generate a patch file for Apache Ant.
Copyright (c) 2003 The Apache Software Foundation. All rights
reserved.
=======================================================================
-->
<project name="create-patch" default="patchpackage" basedir=".">
<property environment="env"/>
<property name="patch.package" value="patch.tar.gz"/>
<property name="patch.file" value="patch.txt"/>
<condition property="svn.found">
<or>
<available file="svn" filepath="${env.PATH}"/>
<available file="svn.exe" filepath="${env.PATH}"/>
<available file="svn.exe" filepath="${env.Path}"/>
</or>
</condition>
<target name="createpatch">
<fail unless="svn.found"
message="You need a version of svn to create the patch"/>
<exec executable="svn" output="${patch.file}">
<arg value="diff"/>
</exec>
</target>
<target name="newfiles" depends="createpatch">
<delete file="${patch.package}"/>
<exec executable="svn" output="${patch.file}.tmp">
<arg value="status"/>
</exec>
<replace file="${patch.file}.tmp" token="? " value=""/>
<tstamp>
<format property="year" pattern="yyyy"/>
</tstamp>
<fileset dir="${basedir}"
includesfile="${patch.file}.tmp"
excludes="${patch.file}.tmp,${patch.file}"
id="no.copyright.set">
<not>
<and>
<contains text="Copyright"/>
<contains text="Apache Software Foundation"/>
<contains text="${year}"/>
</and>
</not>
</fileset>
<pathconvert pathsep="${line.separator}"
setonempty="false"
property="no.copyright"
refid="no.copyright.set"/>
<fail if="no.copyright"
message="Please assign the Apache Ant Copyright (for ${year}) to these files and retry:${line.separator}${no.copyright}"/>
</target>
<target name="patchpackage" depends="newfiles">
<tar basedir="${basedir}"
tarfile="${patch.package}"
compression="gzip"
includesfile="${patch.file}.tmp"
excludes="${patch.file}.tmp"/>
<delete file="${patch.file}.tmp"/>
</target>
</project>