samples/composition/build.xml
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 03 Apr 2020 16:32:36 +0200
changeset 416 9ed8788a1a4e
parent 187 e8db9f297016
permissions -rw-r--r--
Using HTTPS to download the libraries
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <project name="Build Script" default="test" basedir=".">
     3     <target name="clean">
     4         <delete dir="build"/>
     5     </target>
     6     
     7     <target name="compile" depends="build"/>
     8     <target name="build" depends="-libraries">
     9         <antcall target="-build-one">
    10             <param name="version" value="api1.0"/>
    11         </antcall>
    12         <antcall target="-build-one">
    13             <param name="version" value="api2.0"/>
    14         </antcall>
    15         <antcall target="-build-one">
    16             <param name="version" value="api2.0-compat"/>
    17         </antcall>
    18         <antcall target="-build-one">
    19             <param name="version" value="api2.0-property"/>
    20         </antcall>
    21         <antcall target="-build-one">
    22             <param name="version" value="api2.0-enum"/>
    23         </antcall>
    24         <antcall target="-build-one">
    25             <param name="version" value="api2.0-runtime"/>
    26         </antcall>
    27         
    28         <antcall target="-build-one">
    29             <param name="version" value="test"/>
    30             <param name="cp" value="build/api1.0/classes:${junit.jar}"/>
    31         </antcall>
    32     </target>
    33     
    34     <target name="test" depends="build">
    35         <echo level="info" message="Running the Implementation against Version 1.0 of the API. This should succeeds."/>
    36         <antcall target="-run-one">
    37             <param name="version" value="api1.0"/>
    38         </antcall>
    39         <echo level="info" message="Running the Implementation against Version 2.0 of the API. This should fail."/>
    40         <antcall target="-run-one">
    41             <param name="version" value="api2.0"/>
    42         </antcall>
    43         <echo level="info" message="Running the Implementation against Version 2.0 with compatible extension of the API. This should succeed."/>
    44         <antcall target="-run-one">
    45             <param name="version" value="api2.0-compat"/>
    46         </antcall>
    47         <echo level="info" message="Running the Implementation against Version 2.0 with property guarded extension of the API. This should succeed."/>
    48         <antcall target="-run-one">
    49             <param name="version" value="api2.0-property"/>
    50         </antcall>
    51         <echo level="info" message="Running the Implementation against Version 2.0 with enum guarded extension of the API. This should succeed."/>
    52         <antcall target="-run-one">
    53             <param name="version" value="api2.0-enum"/>
    54         </antcall>
    55         <echo level="info" message="Running the Implementation against Version 2.0 with runtime check in the API. This should succeed."/>
    56         <antcall target="-run-one">
    57             <param name="version" value="api2.0-runtime"/>
    58         </antcall>
    59     </target>
    60     
    61     <!-- support methods -->
    62     
    63     <target name="-libraries">
    64         <ant dir="../libs/"/>
    65         
    66         <property name="junit.jar" location="../libs/dist/junit-4.4.jar"/>
    67     </target>
    68     
    69     <target name="-run-one">
    70         <fail message="You need to specify API version number" unless="version"/>
    71         <mkdir dir="build/testresults"/>
    72         <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
    73             <batchtest todir="build/testresults">
    74                 <fileset dir="build/test/classes">
    75                     <filename name="**/*Test.class"/>
    76                 </fileset>
    77             </batchtest>
    78             <classpath>
    79                 <path location="build/${version}/classes"/>
    80                 <path location="build/test/classes"/>
    81                 <path location="${junit.jar}"/>
    82             </classpath>
    83             <syspropertyset>
    84                 <propertyref prefix="test-sys-prop."/>
    85                 <mapper from="test-sys-prop.*" to="*" type="glob"/>
    86             </syspropertyset>
    87             <formatter type="brief" usefile="false"/>
    88             <formatter type="xml"/>
    89         </junit>
    90     </target>
    91     
    92     <target name="-build-one">
    93         <fail message="You need to specify version number" unless="version"/>
    94         
    95         <mkdir dir="build/${version}/classes"/>
    96         <property name="cp" value=""/>
    97         <javac 
    98             srcdir="src-${version}" 
    99             destdir="build/${version}/classes" 
   100             source="1.5" target="1.5"
   101             classpath="${cp}"
   102             debug="true"
   103         />
   104     </target>
   105 </project>