summaryrefslogtreecommitdiff
path: root/patch.xml
blob: 96155bdbdd1dd1e4c3b9fe0201f6fac39d458287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?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="cvs.found">
        <or>
            <available file="cvs" filepath="${env.PATH}"/>
            <available file="cvs.exe" filepath="${env.PATH}"/>
            <available file="cvs.exe" filepath="${env.Path}"/>
        </or>
    </condition>

    <target name="createpatch" if="cvs.found">
        <cvs command="-q diff -u" output="${patch.file}"/>
    </target>

    <target name="newfiles" depends="createpatch">
        <delete file="${patch.package}"/>
        <cvs command="-q diff -N" output="${patch.file}.tmp"/>
        <replace file="${patch.file}.tmp" token="? " value=""/>
        <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"/>
                </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 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>