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