samples/primitiveconstants/build.xml
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 03 Apr 2020 16:32:36 +0200
changeset 416 9ed8788a1a4e
parent 263 7e8e995065c5
permissions -rw-r--r--
Using HTTPS to download the libraries
jtulach@7
     1
<?xml version="1.0" encoding="UTF-8"?>
jtulach@7
     2
<project name="primitiveconstants" default="run" basedir=".">
jtulach@7
     3
    <target name="clean">
jtulach@7
     4
        <delete dir="build"/>
jtulach@7
     5
    </target>
jtulach@263
     6
    <target name="test" depends="run"/>
jtulach@7
     7
    
jtulach@128
     8
    <target name="compile" depends="build"/>
jtulach@7
     9
    <target name="build">
jtulach@7
    10
        <antcall target="-build-one">
jtulach@7
    11
            <param name="version" value="api1.0"/>
jtulach@7
    12
        </antcall>
jtulach@7
    13
        <antcall target="-build-one">
jtulach@7
    14
            <param name="version" value="api2.0"/>
jtulach@7
    15
        </antcall>
jtulach@7
    16
        <antcall target="-build-one">
jtulach@7
    17
            <param name="version" value="impl"/>
jtulach@7
    18
            <param name="cp" location="build/api1.0/classes"/>
jtulach@7
    19
        </antcall>
jtulach@7
    20
    </target>
jtulach@7
    21
    
jtulach@7
    22
    <target name="run" depends="build">
jtulach@9
    23
        <echo level="info" message="Running the Implementation against Version 1.0 of the API. This should succeeds."/>
jtulach@7
    24
        <antcall target="-run-one">
jtulach@7
    25
            <param name="version" value="api1.0"/>
jtulach@263
    26
            <param name="result" value="0"/>
jtulach@7
    27
        </antcall>
jtulach@9
    28
        <echo level="info" message="Running the Implementation against Version 2.0 of the API. This should fail."/>
jtulach@7
    29
        <antcall target="-run-one">
jtulach@8
    30
            <param name="version" value="api2.0"/>
jtulach@263
    31
            <param name="result" value="1"/>
jtulach@7
    32
        </antcall>
jtulach@7
    33
    </target>
jtulach@7
    34
jtulach@7
    35
    
jtulach@7
    36
    <!-- support methods -->
jtulach@7
    37
    
jtulach@7
    38
    <target name="-run-one">
jtulach@7
    39
        <fail message="You need to specify API version number" unless="version"/>
jtulach@7
    40
        <java classpath="build/${version}/classes:build/impl/classes" classname="impl.Impl"
jtulach@264
    41
            resultproperty="result.real" failonerror="false" fork="true"
jtulach@7
    42
        />
jtulach@263
    43
        <fail message="Unexpected failure for ${version}: ${result.real}">
jtulach@263
    44
            <condition>
jtulach@263
    45
                <not>
jtulach@263
    46
                    <equals arg1="${result}" arg2="${result.real}"/>
jtulach@263
    47
                </not>
jtulach@263
    48
            </condition>
jtulach@263
    49
        </fail>
jtulach@7
    50
    </target>
jtulach@7
    51
    
jtulach@7
    52
    <target name="-build-one">
jtulach@7
    53
        <fail message="You need to specify version number" unless="version"/>
jtulach@7
    54
        
jtulach@7
    55
        <mkdir dir="build/${version}/classes"/>
jtulach@7
    56
        <property name="cp" value=""/>
jtulach@7
    57
        <javac 
jtulach@8
    58
            srcdir="src-${version}" 
jtulach@7
    59
            destdir="build/${version}/classes" 
jtulach@7
    60
            source="1.4" target="1.4"
jtulach@7
    61
            classpath="${cp}"
jtulach@7
    62
        />
jtulach@7
    63
    </target>
jtulach@7
    64
</project>