Clean up build file.

This commit is contained in:
garbagemule 2013-06-25 00:37:43 +02:00
parent 5e42887049
commit 534ddbb6e9

221
build.xml
View File

@ -1,133 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="MobArena" default="dist" basedir=".">
<property name="pluginname" value="MobArena" />
<!--
###########################################################################
### ###
### MobArena Build File ###
### ###
###########################################################################
To build MobArena, you need the following dependencies, which can all be
found on their respective websites/Bukkit pages/whatever:
- Craftbukkit
- Vault by Sleaker
- Heroes by the HeroCraft team
- SpoutPlugin by the Spout team
- MagicSpells by nisovin
The dependencies (jar-files) should be placed in a lib-folder at the root
of the project file structure, i.e. in the same folder as 'src'.
-->
<project name="MobArena" default="build-package-distribute" basedir=".">
<!--
###########################################################################
### ###
### Properties File ###
### ###
###########################################################################
The properties file (build.properties) is optional. It can contain the
following properties, which can provide compilation convenience:
- server.dir A path to a location that the MobArena.jar file will be
copied to, upon packaging. This is useful for paths to
a server's plugins-folder for easy testing.
-->
<property file="build.properties"/>
<!-- Folders -->
<property name="src" location="src" />
<property name="bin" location="build" />
<property name="lib" location="lib" />
<property name="res" location="resources" />
<property name="server" location="D:\General\Java\Eclipse\Minecraft\Minecraft Server\plugins" />
<property name="ability-src" location="abilities" />
<property name="ability-dest" location="${res}/res/abilities" />
<!-- Dependency variables -->
<property name="cbver" value="1.2.4-R1.0" />
<property name="cbjar" value="craftbukkit-${cbver}.jar" />
<property name="cburl" value="http://repo.bukkit.org/content/repositories/releases/org/bukkit/craftbukkit/${cbver}/${cbjar}" />
<property name="vltver" value="1.2.12" />
<property name="vltjar" value="Vault-${vltver}-SNAPSHOT.jar" />
<property name="vlturl" value="http://ci.milkbowl.net/job/Vault/Recommended%20Build/artifact/target/${vltjar}" />
<property name="herojar" value="Heroes.jar" />
<property name="herourl" value="http://ci.milkbowl.net/job/Heroes/Heroic%20Build/artifact/build/${herojar}" />
<property name="sptjar" value="SpoutPluginAPI.jar" />
<property name="spturl" value="http://ci.spout.org/job/SpoutPluginAPI/Recommended/artifact/target/${sptjar}" />
<property name="msjar" value="MagicSpells.jar" />
<property name="msurl" value="http://dev.bukkit.org/media/files/577/281/${msjar}" />
<property name="src" location="src"/>
<property name="bin" location="build"/>
<property name="lib" location="lib"/>
<property name="res" location="resources"/>
<!-- Classpath -->
<path id="classpath">
<fileset dir="${lib}" includes="*.jar" />
<fileset dir="${lib}" includes="*.jar"/>
<pathelement location="${bin}" />
</path>
<target name="clean">
<delete dir="${bin}" />
<!--
###########################################################################
### ###
### Distribution targets ###
### ###
###########################################################################
-->
<!-- Copy MobArena.jar to the server.dir folder from the properties file -->
<target name="copy-to-server" if="server.dir">
<copy file="${ant.project.name}.jar" tofile="${server.dir}/${ant.project.name}.jar" />
</target>
<target name="prepare-bin">
<mkdir dir="${bin}" />
<!-- Copy MobArena.jar to the dropbox.dir folder from the properties file -->
<target name="copy-to-dropbox" if="dropbox.dir">
<copy file="${ant.project.name}.jar" tofile="${dropbox.dir}/${ant.project.name}.jar" />
</target>
<target name="prepare-lib">
<mkdir dir="${lib}" />
</target>
<target name="prepare-abilities">
<mkdir dir="${ability-dest}" />
</target>
<!--<target name="copy-abilities">
<mkdir dir="${ability-dest}" />
<copy toDir="${ability-dest}">
<fileset dir="${ability-src}" />
</copy>
</target>-->
<target name="cleanup-abilities">
<delete dir="${ability-dest}" />
</target>
<!-- Builds the source code -->
<target name="build-src" depends="prepare-bin">
<!--
###########################################################################
### ###
### Build targets ###
### ###
###########################################################################
-->
<!-- Build the project files -->
<target name="build">
<antcall target="clean-bin"/>
<mkdir dir="${bin}"/>
<echo>Compiling project...</echo>
<javac target="1.6" source="1.6"
srcdir="${src}" destdir="${bin}"
debug="on" debuglevel="lines,vars,source"
includeantruntime="no">
<compilerarg value="-Xbootclasspath/p:${toString:classpath}"/>
</javac>
</target>
<!-- Builds the source code and shows deprecation issues -->
<target name="build-src-with-deprecation-check" depends="prepare-bin">
<javac target="1.6" source="1.6"
srcdir="${src}" destdir="${bin}"
debug="on" debuglevel="lines,vars,source"
includeantruntime="no">
srcdir="${src}" destdir="${bin}"
debug="on" debuglevel="lines,vars,source"
includeantruntime="no" classpathref="classpath">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xbootclasspath/p:${toString:classpath}"/>
</javac>
</target>
<!-- Builds the ability source code and places it in the resources folder -->
<target name="build-abilities" depends="prepare-abilities">
<javac target="1.6" source="1.6"
srcdir="${ability-src}" destdir="${ability-dest}"
debug="on" debuglevel="lines,vars,source"
includeantruntime="no">
<compilerarg value="-Xbootclasspath/p:${toString:classpath}"/>
</javac>
</target>
<!-- Build a .jar and copy to server's plugins-folder -->
<target name="dist" depends="build-src-with-deprecation-check, build-abilities">
<delete file="${pluginname}.jar" />
<jar jarfile="${pluginname}.jar">
<!-- Build and package the project -->
<target name="build-package">
<antcall target="build"/>
<delete file="${ant.project.name}.jar" />
<jar jarfile="${ant.project.name}.jar">
<!-- Include the class-files (bin) and the resources (res) -->
<fileset dir="${bin}" />
<fileset dir="${res}" />
</jar>
<!-- Copy to server -->
<copy file="${pluginname}.jar" tofile="${server}/${pluginname}.jar" />
<delete dir="${ability-dest}" />
<antcall target="clean-bin"/>
</target>
<!-- Download all dependency jars from the given URLs -->
<target name="download-dependencies" depends="prepare-lib">
<get src="${cburl}"
dest="${lib}/${cbjar}"
usetimestamp="true"
skipexisting="true" />
<get src="${vlturl}"
dest="${lib}/${vltjar}"
usetimestamp="true"
skipexisting="true" />
<get src="${herourl}"
dest="${lib}/${herojar}"
usetimestamp="true"
skipexisting="true" />
<get src="${spturl}"
dest="${lib}/${sptjar}"
usetimestamp="true"
skipexisting="true" />
<get src="${msurl}"
dest="${lib}/${msjar}"
usetimestamp="true"
skipexisting="true" />
<!-- Build, package and distribute the project -->
<target name="build-package-distribute">
<antcall target="build-package"/>
<antcall target="copy-to-server"/>
<antcall target="copy-to-dropbox"/>
</target>
<!--
###########################################################################
### ###
### Clean targets ###
### ###
###########################################################################
-->
<!-- Delete the bin folder -->
<target name="clean-bin">
<delete dir="${bin}"/>
</target>
<!-- Delete the bin folder and the jar-file -->
<target name="clean">
<antcall target="clean-bin"/>
<delete file="${ant.project.name}.jar"/>
</target>
</project>