samples/reexport/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:54:59 +0200
changeset 119 8147cafd007a
parent 97 a1dd8447b30f
child 123 920e95b47036
permissions -rw-r--r--
Creating one master script that can clean and build all examples
     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="query"/>
    17             <param name="cp" value="build/api1.0/classes"/>
    18         </antcall>
    19         <antcall target="-build-one">
    20             <param name="version" value="wrap1.0"/>
    21             <param name="cp" value="build/api1.0/classes"/>
    22         </antcall>
    23         <antcall target="-build-one">
    24             <param name="version" value="wrap2.0"/>
    25             <param name="cp" value="build/api2.0/classes"/>
    26         </antcall>
    27         
    28         <antcall target="-build-one">
    29             <param name="version" value="test"/>
    30             <param name="cp" value="build/api1.0/classes:build/query/classes:${junit.jar}"/>
    31         </antcall>
    32         <antcall target="-build-one">
    33             <param name="version" value="testwrap"/>
    34             <param name="cp" value="build/wrap1.0/classes:${junit.jar}"/>
    35         </antcall>
    36     </target>
    37     
    38     <target name="test" depends="build">
    39         <echo level="info" message="Running the Test against Query and Version 1.0 of String. This should succeeds."/>
    40         <antcall target="-run-one">
    41             <param name="version" value="api1.0"/>
    42             <param name="queryversion" value="query"/>
    43             <param name="test" value="test"/>
    44         </antcall>
    45         <echo level="info" message="Running the Test against Query and Version 2.0 of String. This should fail."/>
    46         <antcall target="-run-one">
    47             <param name="version" value="api2.0"/>
    48             <param name="queryversion" value="query"/>
    49             <param name="test" value="test"/>
    50         </antcall>
    51         <echo level="info" message="Running the Test against Wrapping Query 1.0. This should succeeds."/>
    52         <antcall target="-run-one">
    53             <param name="version" value="api1.0"/>
    54             <param name="queryversion" value="wrap1.0"/>
    55             <param name="test" value="testwrap"/>
    56         </antcall>
    57         <echo level="info" message="Running the Test against Wrapping Query 2.0. This should succeeds."/>
    58         <antcall target="-run-one">
    59             <param name="version" value="api2.0"/>
    60             <param name="queryversion" value="wrap2.0"/>
    61             <param name="test" value="testwrap"/>
    62         </antcall>
    63     </target>
    64     
    65     <!-- support methods -->
    66     
    67     <target name="-libraries">
    68         <ant dir="../libs/"/>
    69         
    70         <property name="junit.jar" location="../libs/dist/junit-4.4.jar"/>
    71     </target>
    72     
    73     <target name="-run-one">
    74         <fail message="You need to specify API version number" unless="version"/>
    75         <mkdir dir="build/${test}results"/>
    76         <junit dir="build/${test}/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
    77             <batchtest todir="build/testresults">
    78                 <fileset dir="build/${test}/classes">
    79                     <filename name="**/*Test.class"/>
    80                 </fileset>
    81             </batchtest>
    82             <classpath>
    83                 <path location="build/${version}/classes"/>
    84                 <path location="build/${queryversion}/classes"/>
    85                 <path location="build/${test}/classes"/>
    86                 <path location="${junit.jar}"/>
    87             </classpath>
    88             <formatter type="brief" usefile="false"/>
    89             <formatter type="xml"/>
    90         </junit>
    91     </target>
    92     
    93     <target name="-build-one">
    94         <fail message="You need to specify version number" unless="version"/>
    95         
    96         <mkdir dir="build/${version}/classes"/>
    97         <property name="cp" value=""/>
    98         <javac 
    99             srcdir="src-${version}" 
   100             destdir="build/${version}/classes" 
   101             source="1.5" target="1.5"
   102             classpath="${cp}"
   103         />
   104     </target>
   105 </project>