samples/composition/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:59:27 +0200
changeset 181 81d72f69fa42
parent 180 131332825eab
child 184 6b2cd8df14c0
permissions -rw-r--r--
Incorporating Patrick's changes. I am not reall sure about the changes after the war, it is really 'or' it cannot be 'and'. I will change that when I do the reading through the whole chapter.
jtulach@15
     1
<?xml version="1.0" encoding="UTF-8"?>
jtulach@17
     2
<project name="Build Script" default="test" basedir=".">
jtulach@17
     3
    <target name="clean">
jtulach@17
     4
        <delete dir="build"/>
jtulach@17
     5
    </target>
jtulach@17
     6
    
jtulach@128
     7
    <target name="compile" depends="build"/>
jtulach@21
     8
    <target name="build" depends="-libraries">
jtulach@17
     9
        <antcall target="-build-one">
jtulach@17
    10
            <param name="version" value="api1.0"/>
jtulach@17
    11
        </antcall>
jtulach@17
    12
        <antcall target="-build-one">
jtulach@17
    13
            <param name="version" value="api2.0"/>
jtulach@17
    14
        </antcall>
jtulach@181
    15
        <antcall target="-build-one">
jtulach@181
    16
            <param name="version" value="api2.0-compat"/>
jtulach@181
    17
        </antcall>
jtulach@181
    18
        <antcall target="-build-one">
jtulach@181
    19
            <param name="version" value="api2.0-property"/>
jtulach@181
    20
        </antcall>
jtulach@181
    21
        <antcall target="-build-one">
jtulach@181
    22
            <param name="version" value="api2.0-enum"/>
jtulach@181
    23
        </antcall>
jtulach@181
    24
        <antcall target="-build-one">
jtulach@181
    25
            <param name="version" value="api2.0-runtime"/>
jtulach@181
    26
        </antcall>
jtulach@17
    27
        
jtulach@17
    28
        <antcall target="-build-one">
jtulach@17
    29
            <param name="version" value="test"/>
jtulach@21
    30
            <param name="cp" value="build/api1.0/classes:${junit.jar}"/>
jtulach@17
    31
        </antcall>
jtulach@17
    32
    </target>
jtulach@17
    33
    
jtulach@17
    34
    <target name="test" depends="build">
jtulach@17
    35
        <echo level="info" message="Running the Implementation against Version 1.0 of the API. This should succeeds."/>
jtulach@17
    36
        <antcall target="-run-one">
jtulach@17
    37
            <param name="version" value="api1.0"/>
jtulach@17
    38
        </antcall>
jtulach@17
    39
        <echo level="info" message="Running the Implementation against Version 2.0 of the API. This should fail."/>
jtulach@17
    40
        <antcall target="-run-one">
jtulach@17
    41
            <param name="version" value="api2.0"/>
jtulach@17
    42
        </antcall>
jtulach@181
    43
        <echo level="info" message="Running the Implementation against Version 2.0 with compatible extension of the API. This should succeed."/>
jtulach@181
    44
        <antcall target="-run-one">
jtulach@181
    45
            <param name="version" value="api2.0-compat"/>
jtulach@181
    46
        </antcall>
jtulach@181
    47
        <echo level="info" message="Running the Implementation against Version 2.0 with property guarded extension of the API. This should succeed."/>
jtulach@181
    48
        <antcall target="-run-one">
jtulach@181
    49
            <param name="version" value="api2.0-property"/>
jtulach@181
    50
        </antcall>
jtulach@181
    51
        <echo level="info" message="Running the Implementation against Version 2.0 with enum guarded extension of the API. This should succeed."/>
jtulach@181
    52
        <antcall target="-run-one">
jtulach@181
    53
            <param name="version" value="api2.0-enum"/>
jtulach@181
    54
        </antcall>
jtulach@181
    55
        <echo level="info" message="Running the Implementation against Version 2.0 with runtime check in the API. This should succeed."/>
jtulach@181
    56
        <antcall target="-run-one">
jtulach@181
    57
            <param name="version" value="api2.0-runtime"/>
jtulach@181
    58
        </antcall>
jtulach@17
    59
    </target>
jtulach@17
    60
    
jtulach@17
    61
    <!-- support methods -->
jtulach@17
    62
    
jtulach@21
    63
    <target name="-libraries">
jtulach@21
    64
        <ant dir="../libs/"/>
jtulach@21
    65
        
jtulach@21
    66
        <property name="junit.jar" location="../libs/dist/junit-4.4.jar"/>
jtulach@21
    67
    </target>
jtulach@21
    68
    
jtulach@17
    69
    <target name="-run-one">
jtulach@17
    70
        <fail message="You need to specify API version number" unless="version"/>
jtulach@19
    71
        <mkdir dir="build/testresults"/>
jtulach@19
    72
        <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
jtulach@19
    73
            <batchtest todir="build/testresults">
jtulach@19
    74
                <fileset dir="build/test/classes">
jtulach@19
    75
                    <filename name="**/*Test.class"/>
jtulach@19
    76
                </fileset>
jtulach@19
    77
            </batchtest>
jtulach@19
    78
            <classpath>
jtulach@19
    79
                <path location="build/${version}/classes"/>
jtulach@19
    80
                <path location="build/test/classes"/>
jtulach@21
    81
                <path location="${junit.jar}"/>
jtulach@19
    82
            </classpath>
jtulach@19
    83
            <formatter type="brief" usefile="false"/>
jtulach@19
    84
            <formatter type="xml"/>
jtulach@19
    85
        </junit>
jtulach@17
    86
    </target>
jtulach@17
    87
    
jtulach@17
    88
    <target name="-build-one">
jtulach@17
    89
        <fail message="You need to specify version number" unless="version"/>
jtulach@17
    90
        
jtulach@17
    91
        <mkdir dir="build/${version}/classes"/>
jtulach@17
    92
        <property name="cp" value=""/>
jtulach@17
    93
        <javac 
jtulach@17
    94
            srcdir="src-${version}" 
jtulach@17
    95
            destdir="build/${version}/classes" 
jtulach@17
    96
            source="1.5" target="1.5"
jtulach@17
    97
            classpath="${cp}"
jtulach@17
    98
        />
jtulach@17
    99
    </target>
jtulach@15
   100
</project>