samples/visitor/21-clientprovider/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:59:16 +0200
changeset 176 0f658628beac
child 177 67d6dceb1002
permissions -rw-r--r--
First two versions of client provider Visitor
     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         
    16         <antcall target="-build-one">
    17             <param name="version" value="test"/>
    18             <param name="cp" value="build/api1.0/classes:${junit.jar}"/>
    19         </antcall>
    20 
    21         <echo level="info" message="Next compilation will fails, as adding methods into interface is not binary compatible"/>
    22         <antcall target="-build-one">
    23             <param name="version" value="test"/>
    24             <param name="out" value="will-not-compile"/>
    25             <param name="cp" value="build/api2.0/classes:${junit.jar}"/>
    26             <param name="failonerror" value="false"/>
    27         </antcall>
    28 
    29         <antcall target="-build-one">
    30             <param name="version" value="test2.0"/>
    31             <param name="cp" value="build/api2.0/classes:build/test/classes:${junit.jar}"/>
    32         </antcall>
    33     </target>
    34     
    35     <target name="test" depends="build">
    36         <echo level="info" message="PrintVisitor on old API. This should succeeds."/>
    37         <antcall target="-run-one">
    38             <param name="version" value="api1.0"/>
    39         </antcall>
    40         <echo level="info" message="PrintVisitor on old API. This would not compile, but it runs as it does not deal with minus at all."/>
    41         <antcall target="-run-one">
    42             <param name="version" value="api2.0"/>
    43         </antcall>
    44         <echo level="info" message="PrintVisitor on new API. This yields runtime error."/>
    45         <antcall target="-run-one">
    46             <param name="test" value="test2.0"/>
    47             <param name="extra.cp" value="build/test/classes"/>
    48             <param name="version" value="api2.0"/>
    49         </antcall>
    50     </target>
    51     
    52     <!-- support methods -->
    53     
    54     <target name="-libraries">
    55         <ant dir="../../libs/"/>
    56         
    57         <property name="junit.jar" location="../../libs/dist/junit-4.4.jar"/>
    58     </target>
    59     
    60     <target name="-run-one">
    61         <fail message="You need to specify API version number" unless="version"/>
    62         <property name="test" value="test"/>
    63         <mkdir dir="build/${test}results${version}"/>
    64         <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
    65             <batchtest todir="build/${test}results${version}">
    66                 <fileset dir="build/${test}/classes">
    67                     <filename name="**/*Test.class"/>
    68                 </fileset>
    69             </batchtest>
    70             <classpath>
    71                 <path location="build/${version}/classes"/>
    72                 <path location="build/${test}/classes"/>
    73                 <path location="${junit.jar}"/>
    74                 <path path="${extra.cp}"/>
    75             </classpath>
    76             <formatter type="brief" usefile="false"/>
    77             <formatter type="xml"/>
    78         </junit>
    79     </target>
    80     
    81     <target name="-build-one">
    82         <fail message="You need to specify version number" unless="version"/>
    83         
    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         />
    95     </target>
    96 </project>