samples/composition/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:59:27 +0200
changeset 181 81d72f69fa42
parent 180 131332825eab
child 184 6b2cd8df14c0
permissions -rw-r--r--
Incorporating Patrick's changes. I am not reall sure about the changes after the war, it is really 'or' it cannot be 'and'. I will change that when I do the reading through the whole chapter.
     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             <formatter type="brief" usefile="false"/>
    84             <formatter type="xml"/>
    85         </junit>
    86     </target>
    87     
    88     <target name="-build-one">
    89         <fail message="You need to specify version number" unless="version"/>
    90         
    91         <mkdir dir="build/${version}/classes"/>
    92         <property name="cp" value=""/>
    93         <javac 
    94             srcdir="src-${version}" 
    95             destdir="build/${version}/classes" 
    96             source="1.5" target="1.5"
    97             classpath="${cp}"
    98         />
    99     </target>
   100 </project>