[Home]Ant/SampleBuildFile

Robo Home | Ant | Changes | Preferences | AllPages

Showing revision 1
Hexkids sample Ant build.xml:
<?xml version="1.0"?>
<project name="Robocode" default="deployjar" basedir=".">
	<!-- INIT: Set constants for project -->
	<target name="init">
        <property name="ROBOTNAME" value="MyRobot"/>
        <property name="package" value="MyPackage"/>

        <!-- Create the property file that describes this robot -->
        <propertyfile file="${ROBOTNAME}.properties">
            <entry key="robot.description" value=""/>
            <entry key="robot.java.source.included" value="true"/>
            <entry key="robocode.version" value="1.0.6"/>
            <entry key="robot.version" value="0.1"/>
            <entry key="robot.author.name" value=""/>
            <entry key="robot.classname" value="${package}.${ROBOTNAME}"/>
        </propertyfile>


        <property file="${ROBOTNAME}.properties" description="Use the entries from the properties file within this script."/>
		<property name="ROBOCODE_HOME" value="c:\robocode"/>
        <property name="JAR_NAME" value="${robot.classname}_${robot.version}.jar"/>
		<property name="COMPILE_WITH_DEBUG" value="off"/>
		<property name="VERBOSE_LEVEL" value="1"/>
		<property name="CLASSPATH" value="./classes;${ROBOCODE_HOME}/robocode.jar"/>
		<property name="COMPILECLASSNAME" value=""/>

	</target>

	<!-- CLEANLOCAL: Delete the local filesystem directories which contain generated files -->
	<target name="cleanlocal" depends="init" description="Remove the directories containing the classes and the jar file">
		<delete dir="jars"/>
		<delete dir="classes"/>
	</target>
	<!-- PREPARE: Create directories for generated files -->
	<target name="prepare" depends="init" description="Create the generated directories">
		<mkdir dir="jars"/>
		<mkdir dir="classes"/>
	</target>
	<!-- COMPILE: Compile all java files in the project
         This task will compile all classes that have been modified since the previous compilation.
           -->
	<target name="compile" depends="prepare" description="Compile the Java classes">
		<javac srcdir="src" destdir="classes" classpath="${CLASSPATH}" debug="${COMPILE_WITH_DEBUG}" includes="**/*.java"/>
	</target>
	<!-- BUILDCOMPONENTJAR: Build the war jar file containing classes, jars, jsps, images, html files, and deployment descriptor -->
	<target name="buildjar" depends="compile" description="Construct the Jar file containing the robot">
		<!-- Build the JAR containing all of the classes -->
		<jar jarfile="jars/${JAR_NAME}" filesonly="true">
		   	<fileset dir="classes" includes="**\*.class"/>
            <fileset dir="src" includes="**\*.java"/>
            <fileset dir="." includes="${ROBOTNAME}.properties"/>
		</jar>
	</target>
	<!-- DEPLOYJAR: Deploy the jar to the robocode/robots directory -->
	<target name="deployjar" depends="buildjar" description="Copy the Robot Jar file to Robocode/robots directory">
        <copy file="jars/${JAR_NAME}" overwrite="true" todir="${ROBOCODE_HOME}/robots"/>
	</target>
    <target name="javadoc" depends="compile" description="Generate the JavaDoc Documentation">
        <delete dir="javadoc"/>
        <mkdir dir="javadoc"/>
        <javadoc sourcepath="src" destdir="javadoc" packagenames="*" classpath="{CLASSPATH}"/>
        <echoproperties>
        </echoproperties>
    </target>
	<!-- FULL: Default target which rebuilds and redeploys the whole application & generates the JavaDoc-->
	<target name="full" depends="cleanlocal,deployjar,javadoc"/>
</project>

Robo Home | Ant | Changes | Preferences | AllPages
Edit revision 1 of this page | View other revisions | View current revision
Edited March 15, 2003 15:35 EST by PEZ (diff)
Search: