build script for version like project
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:50:51 +0200
changeset 7041165540a13
parent 6 b577ee7fcf67
child 8 82ff02d7f861
build script for version like project
samples/primitiveconstants/build.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/primitiveconstants/build.xml	Sat Jun 14 09:50:51 2008 +0200
     1.3 @@ -0,0 +1,53 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<project name="primitiveconstants" default="run" basedir=".">
     1.6 +    <target name="clean">
     1.7 +        <delete dir="build"/>
     1.8 +    </target>
     1.9 +    
    1.10 +    <target name="build">
    1.11 +        <antcall target="-build-one">
    1.12 +            <param name="version" value="api1.0"/>
    1.13 +        </antcall>
    1.14 +        <antcall target="-build-one">
    1.15 +            <param name="version" value="api2.0"/>
    1.16 +        </antcall>
    1.17 +        <antcall target="-build-one">
    1.18 +            <param name="version" value="impl"/>
    1.19 +            <param name="cp" location="build/api1.0/classes"/>
    1.20 +        </antcall>
    1.21 +    </target>
    1.22 +    
    1.23 +    <target name="run" depends="build">
    1.24 +        <echo message="Running the Implementation against Version 1.0 of the API. This should succeeds."/>
    1.25 +        <antcall target="-run-one">
    1.26 +            <param name="version" value="api1.0"/>
    1.27 +        </antcall>
    1.28 +        <echo message="Running the Implementation against Version 2.0 of the API. This should fail."/>
    1.29 +        <antcall target="-run-one">
    1.30 +            <param name="version" value="api1.0"/>
    1.31 +        </antcall>
    1.32 +    </target>
    1.33 +
    1.34 +    
    1.35 +    <!-- support methods -->
    1.36 +    
    1.37 +    <target name="-run-one">
    1.38 +        <fail message="You need to specify API version number" unless="version"/>
    1.39 +        <java classpath="build/${version}/classes:build/impl/classes" classname="impl.Impl"
    1.40 +            failonerror="true"
    1.41 +        />
    1.42 +    </target>
    1.43 +    
    1.44 +    <target name="-build-one">
    1.45 +        <fail message="You need to specify version number" unless="version"/>
    1.46 +        
    1.47 +        <mkdir dir="build/${version}/classes"/>
    1.48 +        <property name="cp" value=""/>
    1.49 +        <javac 
    1.50 +            src="src-${version}" 
    1.51 +            destdir="build/${version}/classes" 
    1.52 +            source="1.4" target="1.4"
    1.53 +            classpath="${cp}"
    1.54 +        />
    1.55 +    </target>
    1.56 +</project>