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