samples/messagedigest/build.xml
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 03 Apr 2020 16:32:36 +0200
changeset 416 9ed8788a1a4e
parent 128 8ef997796d0a
permissions -rw-r--r--
Using HTTPS to download the libraries
jtulach@37
     1
<?xml version="1.0" encoding="UTF-8"?>
jtulach@44
     2
<project name="Build Script" default="test" basedir=".">
jtulach@44
     3
    <target name="clean">
jtulach@44
     4
        <delete dir="build"/>
jtulach@44
     5
    </target>
jtulach@44
     6
    
jtulach@128
     7
    <target name="compile" depends="build"/>
jtulach@44
     8
    <target name="build" depends="-libraries">
jtulach@44
     9
        <antcall target="-build-one">
jtulach@44
    10
            <param name="version" value="new-api"/>
jtulach@44
    11
        </antcall>
jtulach@44
    12
        <antcall target="-build-one">
jtulach@51
    13
            <param name="version" value="bridge"/>
jtulach@50
    14
            <param name="cp" value="build/new-api/classes"/>
jtulach@50
    15
        </antcall>
jtulach@44
    16
        
jtulach@44
    17
        <antcall target="-build-one">
jtulach@44
    18
            <param name="version" value="test"/>
jtulach@51
    19
            <param name="cp" value="build/new-api/classes:${junit.jar}"/>
jtulach@44
    20
        </antcall>
jtulach@44
    21
    </target>
jtulach@44
    22
    
jtulach@51
    23
    <target name="test">
jtulach@51
    24
        <antcall target="-do-test">
jtulach@51
    25
            <param name="nodebug" value="true"/>
jtulach@51
    26
        </antcall>
jtulach@51
    27
    </target>
jtulach@51
    28
        
jtulach@51
    29
    <target name="-do-test" depends="build">
jtulach@44
    30
        <echo level="info" message="Running the tests with bridge enabled. This should succeeds."/>
jtulach@44
    31
        <antcall target="-run-one">
jtulach@51
    32
            <param name="test.cp" value="build/new-api/classes:build/bridge/classes"/>
jtulach@44
    33
        </antcall>
jtulach@44
    34
        <echo level="info" message="Running the tests without bridge module. This should fail."/>
jtulach@44
    35
        <antcall target="-run-one">
jtulach@51
    36
            <param name="test.cp" value="build/new-api/classes"/>
jtulach@263
    37
            <param name="test-sys-prop.no.md5" value="true"/>
jtulach@44
    38
        </antcall>
jtulach@44
    39
    </target>
jtulach@44
    40
    
jtulach@44
    41
    <!-- support methods -->
jtulach@44
    42
    
jtulach@44
    43
    <target name="-libraries">
jtulach@44
    44
        <ant dir="../libs/"/>
jtulach@44
    45
        
jtulach@44
    46
        <property name="junit.jar" location="../libs/dist/junit-4.4.jar"/>
jtulach@44
    47
    </target>
jtulach@51
    48
jtulach@51
    49
    <target name="-debug-one" if="netbeans.home" unless="nodebug">
jtulach@51
    50
        <nbjpdastart addressproperty="jpda.address" name="MessageDigest and Bridges" transport="dt_socket" >
jtulach@51
    51
            <sourcepath path="src-new-api:src-bridge:src-test:build/test/classes"/>
jtulach@51
    52
            <classpath path="build/new-api/classes:build/bridge/classes:build/test/classes"/>
jtulach@51
    53
        </nbjpdastart>
jtulach@51
    54
        <property name="debug1" value="-Xdebug"/>
jtulach@51
    55
        <property name="debug2" value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
jtulach@51
    56
    </target>
jtulach@44
    57
    
jtulach@51
    58
    <target name="-run-one" depends="-debug-one">
jtulach@51
    59
        <property name="debug1" value="-Dn1"/>
jtulach@51
    60
        <property name="debug2" value="-Dn2"/>
jtulach@51
    61
        <property name="include" value="**/*Test"/>
jtulach@44
    62
        <mkdir dir="build/testresults"/>
jtulach@44
    63
        <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
jtulach@44
    64
            <batchtest todir="build/testresults">
jtulach@44
    65
                <fileset dir="build/test/classes">
jtulach@51
    66
                    <filename name="${include}.class"/>
jtulach@44
    67
                </fileset>
jtulach@44
    68
            </batchtest>
jtulach@44
    69
            <classpath>
jtulach@44
    70
                <path path="${test.cp}"/>
jtulach@44
    71
                <path location="build/test/classes"/>
jtulach@44
    72
                <path location="${junit.jar}"/>
jtulach@44
    73
            </classpath>
jtulach@263
    74
            <syspropertyset>
jtulach@263
    75
                <propertyref prefix="test-sys-prop."/>
jtulach@263
    76
                <mapper from="test-sys-prop.*" to="*" type="glob"/>
jtulach@263
    77
            </syspropertyset>
jtulach@44
    78
            <formatter type="brief" usefile="false"/>
jtulach@44
    79
            <formatter type="xml"/>
jtulach@51
    80
            <jvmarg value="${debug1}"/>
jtulach@51
    81
            <jvmarg value="${debug2}"/>
jtulach@44
    82
        </junit>
jtulach@44
    83
    </target>
jtulach@44
    84
    
jtulach@44
    85
    <target name="-build-one">
jtulach@44
    86
        <fail message="You need to specify version number" unless="version"/>
jtulach@44
    87
        
jtulach@44
    88
        <mkdir dir="build/${version}/classes"/>
jtulach@44
    89
        <property name="cp" value=""/>
jtulach@44
    90
        <javac 
jtulach@44
    91
            srcdir="src-${version}" 
jtulach@44
    92
            destdir="build/${version}/classes" 
jtulach@44
    93
            source="1.5" target="1.5"
jtulach@44
    94
            classpath="${cp}"
jtulach@51
    95
            debug="true" debuglevel="lines,vars,source"
jtulach@44
    96
        />
jtulach@44
    97
        <copy todir="build/${version}/classes">
jtulach@44
    98
            <fileset dir="src-${version}">
jtulach@44
    99
                <exclude name="**/*.java"/>
jtulach@44
   100
            </fileset>
jtulach@44
   101
        </copy>
jtulach@44
   102
    </target>
jtulach@37
   103
</project>