[Home]History of Ant/SampleBuildFile

Robo Home | Changes | Preferences | AllPages


Revision 2 . . March 15, 2003 23:42 EST by Hexkid
Revision 1 . . March 15, 2003 15:35 EST by PEZ
  

Difference (from prior major revision) (no other diffs)

Removed: 64,65d63
<echoproperties>
</echoproperties>

Changed: 70c68,105
</pre>
</pre>

How I Use Ant



First of all make sure that you have Apache Ant installed. It can be downloaded from [Ant Home Page]. Probably easiest to add the Ant/bin directory to your PATH environment variable.

I tend to create a new directory for each Robot that I work on & treat each Robot as a separate project.

This directory has the following format:

RobotNameDir?
src - The source code for the Robot. This is the parent directory of my Java package structure.
classes - Where the Java classes are created by the compiler. This directory will be automatically created by the Ant script.
javadoc - The automatically generated documentation for my Robot's classes.
jars - The directory that holds the JAR file for the robot after it has been packaged.

* Copy the XML from above and create a file called build.xml (this is the default name used by Ant) in the Robot's root directory.
* Edit the build.xml file and set the properties at the top of the file to match the details of your robot and your installation of Robocode.
* Create your Java source code
* Run Ant from the command line to perform the task that you want to carry out. This should be executed from the Robot's root directory. This is done by selecting the name of the target in the build file that you want to execute.
For example: to compile the Bot without creating the JAR file you will need to enter "ant compile" at the command prompt.

The Sample Ant Build file contains the following targets:









Target NameDescription
cleanlocalDelete the automatically generated directories i.e. classes & jar.
prepareCreate the classes & jar directories.
compileCompile all of the Java classes in the project that need compilation.
buildjarCreate the JAR file that contains the classes & the properties of the Robot
deployjarCopy the JAR file to the robocode/robots directory
javadocGenerate documentation on my robot. This documentation is the standard JavaDoc? for the all of the classes defined in my Robot
fullDo everything


The build file also includes the inter-dependancies between the tasks. For example, if you specify the 'deployjar' target Ant will compile any classes that need compiling & then build the jar before it is deployed.

To Do



Trying to create the following Ant tasks:
* one that automatically sends updated Bots to the RobocodeRepository
* One that executes test battles against selected Bots. A sort of modified version of RoboLeague so that I can test whether the modifications that I have made to the code actually improve the performance.

Robo Home | Changes | Preferences | AllPages
Search: