-
Notifications
You must be signed in to change notification settings - Fork 1
Developer Guide
Note: This developer guide is inspired by daCruzer's development guide.
The source can be obtained either by forking or cloning this repository, or by downloading the source from our homepage.
In order to use WrathOfPele, you'll need to install both the Robocode basic distribution and the Robocode testing distribution.
The jars for both of the needed distributions can be found at http://sourceforge.net/projects/robocode/files/robocode/1.7.4.4/
Note: There is a newer version of Robocode available, however, WrathOfPele was built and tested against 1.7.4.4. If you have success running WrathOfPele 1.8, I would love to hear about it.
Install Maven by following these directions.
After Maven is installed, test it by running:
mvn --version
Since the Robocode jar files are not in any public Maven repositories, the jars required by Robocode must be manually added to the local Maven repository.
From your command prompt, set the current working directory to the robocode/libs directory. Then, you can simply copy and paste the following commands to add the specified jars to the local Maven repository.
mvn install:install-file -Dfile=robocode.jar -DartifactId=robocode -DgroupId=net.sourceforge.robocode -Dversion=1.7.4.4 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=robocode.testing.jar -DartifactId=robocode.testing -DgroupId=net.sourceforge.robocode -Dversion=1.7.4.4 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=robocode.battle-1.7.4.4.jar -DartifactId=robocode.battle -DgroupId=net.sourceforge.robocode -Dversion=1.7.4.4 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=robocode.core-1.7.4.4.jar -DartifactId=robocode.core -DgroupId=net.sourceforge.robocode -Dversion=1.7.4.4 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=robocode.host-1.7.4.4.jar -DartifactId=robocode.host -DgroupId=net.sourceforge.robocode -Dversion=1.7.4.4 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=robocode.repository-1.7.4.4.jar -DartifactId=robocode.repository -DgroupId=net.sourceforge.robocode -Dversion=1.7.4.4 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=picocontainer-2.14.2.jar -DgroupId=net.sourceforge.robocode -DartifactId=picocontainer -Dversion=2.14.2 -Dpackaging=jar -DgeneratePom=true
Maven should report a BUILD SUCCESS for each jar.
Maven handles building, testing, and quality assurance.
In order for any Maven lifecycle which includes testing (such as test, verify, package, etc) to work, we have to provide Maven with a special command line argument which points to your Robocode installation directory. This happens because the pom file includes a plugin which copies the built robots to the robocode/robots directory for testing.
In order to run a Maven lifecycle which includes testing, modify your command to look like the following:
mvn -Drobocode.home=/path/to/robocode lifecycle
To test that you have the build environment set up correctly, run
mvn -Drobocode.home=/path/to/robocode test
You should see a large amount of tests running with a Maven conclusion of BUILD SUCCESS.
To generate Javadoc for WrathOfPele, set your command line working directory to the WrathOfPele project directory and execute
mvn javadoc:javadoc
The command should finish with BUILD SUCCESS and the outputted Javadoc can be found under target/site/apidocs/index.html
First, install the m2e Maven plugin for Eclipse. Then import the WrathOfPele project into Eclipse by selecting in Eclipse:
File -> Import -> Maven -> Existing Maven Projects
You need to set the working directory under Run configuration to point to the Robocode installation directory.
In Robocode, you must point the program to the directory where your built robot classes are stored. This can be configured in Robocode by selection:
Options -> Preferences -> Development Options
If you plan on running test cases from within Eclipse, you need to add the argument -Drobocode.home=/path/to/robocode as a VM argument under the run configuration for each test.
Please see this guide or this screencast for more information on configuring the Eclipse environment to work with Robocode.
This project's POM file already includes configurations for three software quality assurance tools: checkstyle, PMD, and FindBugs. For more information on these tools, see a previous blog posting of mine.
If you wish to contribute to this project, the source must be free of errors from all three quality assurance tools. To run each tool, set the command line's current working directory to the WrathOfPele project directory. Then each tool can be invoked in the following ways. You should note that running the verify lifecycle will also invoke the usage of these three tools.
mvn checkstyle:check
mvn pmd:check
mvn findbugs:checks
The output from each command should return a BUILD SUCCESS.
The set of rules used by checkstyle can be found at http://ics-software-engineering.googlecode.com/svn/trunk/configfiles/checkstyle.xml.
The set of rules used by PMD can be found at http://ics-software-engineering.googlecode.com/svn/trunk/configfiles/pmd.rulesets.xml.
FindBugs uses its default set of rules.
Jacoco is a code coverage tool which is only ran during the verify lifecycle of Maven. This tool expects all classes to have 100% code coverage 85% coverage on methods in WrathOfPele.
Jacoco can only be run during the verify lifecycle. To invoke Jacoco run:
mvn -Drobocode.home=/path/to/robocode verify
At the end of the verify process, Jacoco will run. If the code coverage is too low, the process will fail, otherwise, you will see BUILD SUCCESS.
The detailed coverage report can be found in target/site/jacoco.
The entire package must pass the verify lifecycle of Maven. This includes passing all tests, checkstyle, PMD, FingBugs, and Jacoco coverage.
You should follow this general development process:
- Update your local repository from GitHub.
- Run the Maven verify lifecycle to make sure the system is in a clean state.
- If the verify goal fails on a clean fork/clone, contact the developers with the error information or file an issue.
- If system is in a clean state, hack away.
- Before committing the new changes, ensure the system is in a clean state by running the verify lifecycle.
- Commit changes.
- Submit pull request if you would like to see your changes in upstream.
To create a new binary release, install your Robot into the robocode/robots directory using the normal development process, then use the GUI interface to package your robot for distribution. It will create a jar file with the robot name and a release number. Check the release/ directory for the last binary release number, and choose a new release number appropriately.
Copy the jar file to the release directory and push the change to GitHub to make the new binary release publicly available.
Happy Hacking :)