samples/visitor/21-clientprovider/build.xml
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 30 Oct 2014 20:46:27 +0100
changeset 408 9a439a79c6d0
parent 182 77b3c0f1e4c3
permissions -rw-r--r--
Use scala 2.10.4 to compile on JDK8
     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="api3.0"/>
    17         </antcall>
    18         
    19         <antcall target="-build-one">
    20             <param name="version" value="test"/>
    21             <param name="cp" value="build/api1.0/classes:${junit.jar}"/>
    22         </antcall>
    23 
    24         <antcall target="-build-one">
    25             <param name="version" value="test2.0"/>
    26             <param name="cp" value="build/api2.0/classes:build/test/classes:${junit.jar}"/>
    27         </antcall>
    28         <antcall target="-build-one">
    29             <param name="version" value="test3.0"/>
    30             <param name="cp" value="build/api3.0/classes:build/test/classes:build/test2.0/classes:${junit.jar}"/>
    31         </antcall>
    32     </target>
    33     
    34     <target name="test" depends="build">
    35         <echo level="info" message="PrintVisitor on old API. This should succeeds."/>
    36         <antcall target="-run-one">
    37             <param name="version" value="api1.0"/>
    38         </antcall>
    39         <echo level="info" message="PrintVisitor on old API. This would not compile, but it runs as it does not deal with minus at all."/>
    40         <antcall target="-run-one">
    41             <param name="version" value="api2.0"/>
    42         </antcall>
    43         <echo level="info" message="PrintVisitor on new API. This yields runtime error."/>
    44         <antcall target="-run-one">
    45             <param name="test" value="test2.0"/>
    46             <param name="extra.cp" value="build/test/classes"/>
    47             <param name="version" value="api2.0"/>
    48         </antcall>
    49         <echo level="info" message="Using old Number with new visitors"/>
    50         <antcall target="-run-one">
    51             <param name="test" value="test3.0"/>
    52             <param name="extra.cp" value="build/test/classes:build/test2.0/classes:"/>
    53             <param name="version" value="api3.0"/>
    54         </antcall>
    55     </target>
    56     
    57     <!-- support methods -->
    58     
    59     <target name="-libraries">
    60         <ant dir="../../libs/"/>
    61         
    62         <property name="junit.jar" location="../../libs/dist/junit-4.4.jar"/>
    63     </target>
    64     
    65     <target name="-run-one">
    66         <fail message="You need to specify API version number" unless="version"/>
    67         <property name="test" value="test"/>
    68         <mkdir dir="build/${test}results${version}"/>
    69         <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
    70             <batchtest todir="build/${test}results${version}">
    71                 <fileset dir="build/${test}/classes">
    72                     <filename name="**/*Test.class"/>
    73                 </fileset>
    74             </batchtest>
    75             <classpath>
    76                 <path location="build/${version}/classes"/>
    77                 <path location="build/${test}/classes"/>
    78                 <path location="${junit.jar}"/>
    79                 <path path="${extra.cp}"/>
    80             </classpath>
    81             <syspropertyset>
    82                 <propertyref prefix="test-sys-prop."/>
    83                 <mapper from="test-sys-prop.*" to="*" type="glob"/>
    84             </syspropertyset>
    85             <formatter type="brief" usefile="false"/>
    86             <formatter type="xml"/>
    87         </junit>
    88     </target>
    89     
    90     <target name="-build-one">
    91         <fail message="You need to specify version number" unless="version"/>
    92         
    93         <property name="cp" value=""/>
    94         <property name="out" value="${version}"/>
    95         <property name="failonerror" value="true"/>
    96         <mkdir dir="build/${out}/classes"/>
    97         <javac 
    98             srcdir="src-${version}" 
    99             destdir="build/${out}/classes" 
   100             source="1.5" target="1.5"
   101             classpath="${cp}"
   102             failonerror="${failonerror}"
   103             debug="true"
   104         />
   105     </target>
   106 </project>