samples/componentinjection/anagram-modular/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 10:06:45 +0200
changeset 215 43b122711ae1
child 219 3fb53f65db57
permissions -rw-r--r--
Defining APIs for the modular interfaces
     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="api"/>
    11         </antcall>
    12         
    13         <antcall target="-build-one">
    14             <param name="version" value="test"/>
    15             <param name="cp" value="build/new-api/classes:${junit.jar}"/>
    16         </antcall>
    17     </target>
    18     
    19     <target name="test">
    20         <antcall target="-do-test">
    21             <param name="nodebug" value="true"/>
    22         </antcall>
    23     </target>
    24         
    25     <target name="-do-test" depends="build">
    26         <echo level="info" message="Running the tests with bridge enabled. This should succeeds."/>
    27         <antcall target="-run-one">
    28             <param name="test.cp" value="build/new-api/classes:build/bridge/classes"/>
    29         </antcall>
    30         <echo level="info" message="Running the tests without bridge module. This should fail."/>
    31         <antcall target="-run-one">
    32             <param name="test.cp" value="build/new-api/classes"/>
    33         </antcall>
    34     </target>
    35     
    36     <!-- support methods -->
    37     
    38     <target name="-libraries">
    39         <ant dir="../../libs/"/>
    40         
    41         <property name="junit.jar" location="../libs/dist/junit-4.4.jar"/>
    42     </target>
    43 
    44     <target name="-debug-one" if="netbeans.home" unless="nodebug">
    45         <nbjpdastart addressproperty="jpda.address" name="MessageDigest and Bridges" transport="dt_socket" >
    46             <sourcepath path="src-new-api:src-bridge:src-test:build/test/classes"/>
    47             <classpath path="build/new-api/classes:build/bridge/classes:build/test/classes"/>
    48         </nbjpdastart>
    49         <property name="debug1" value="-Xdebug"/>
    50         <property name="debug2" value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
    51     </target>
    52     
    53     <target name="-run-one" depends="-debug-one">
    54         <property name="debug1" value="-Dn1"/>
    55         <property name="debug2" value="-Dn2"/>
    56         <property name="include" value="**/*Test"/>
    57         <mkdir dir="build/testresults"/>
    58         <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
    59             <batchtest todir="build/testresults">
    60                 <fileset dir="build/test/classes">
    61                     <filename name="${include}.class"/>
    62                 </fileset>
    63             </batchtest>
    64             <classpath>
    65                 <path path="${test.cp}"/>
    66                 <path location="build/test/classes"/>
    67                 <path location="${junit.jar}"/>
    68             </classpath>
    69             <formatter type="brief" usefile="false"/>
    70             <formatter type="xml"/>
    71             <jvmarg value="${debug1}"/>
    72             <jvmarg value="${debug2}"/>
    73         </junit>
    74     </target>
    75     
    76     <target name="-build-one">
    77         <fail message="You need to specify version number" unless="version"/>
    78         
    79         <mkdir dir="build/${version}/classes"/>
    80         <property name="cp" value=""/>
    81         <javac 
    82             srcdir="src-${version}" 
    83             destdir="build/${version}/classes" 
    84             source="1.5" target="1.5"
    85             classpath="${cp}"
    86             debug="true" debuglevel="lines,vars,source"
    87         />
    88         <copy todir="build/${version}/classes">
    89             <fileset dir="src-${version}">
    90                 <exclude name="**/*.java"/>
    91             </fileset>
    92         </copy>
    93     </target>
    94 </project>