Clean up build file.

This commit is contained in:
garbagemule
2013-06-25 00:37:43 +02:00
parent 5e42887049
commit 534ddbb6e9
+111 -110
View File
@@ -1,133 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?> <?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 --> <!-- Folders -->
<property name="src" location="src" /> <property name="src" location="src"/>
<property name="bin" location="build" /> <property name="bin" location="build"/>
<property name="lib" location="lib" /> <property name="lib" location="lib"/>
<property name="res" location="resources" /> <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}" />
<!-- Classpath -->
<path id="classpath"> <path id="classpath">
<fileset dir="${lib}" includes="*.jar" /> <fileset dir="${lib}" includes="*.jar"/>
<pathelement location="${bin}" /> <pathelement location="${bin}" />
</path> </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>
<target name="prepare-bin"> <!-- Copy MobArena.jar to the dropbox.dir folder from the properties file -->
<mkdir dir="${bin}" /> <target name="copy-to-dropbox" if="dropbox.dir">
<copy file="${ant.project.name}.jar" tofile="${dropbox.dir}/${ant.project.name}.jar" />
</target> </target>
<target name="prepare-lib">
<mkdir dir="${lib}" />
</target> <!--
###########################################################################
<target name="prepare-abilities"> ### ###
<mkdir dir="${ability-dest}" /> ### Build targets ###
</target> ### ###
###########################################################################
<!--<target name="copy-abilities"> -->
<mkdir dir="${ability-dest}" />
<copy toDir="${ability-dest}"> <!-- Build the project files -->
<fileset dir="${ability-src}" /> <target name="build">
</copy> <antcall target="clean-bin"/>
</target>--> <mkdir dir="${bin}"/>
<echo>Compiling project...</echo>
<target name="cleanup-abilities">
<delete dir="${ability-dest}" />
</target>
<!-- Builds the source code -->
<target name="build-src" depends="prepare-bin">
<javac target="1.6" source="1.6" <javac target="1.6" source="1.6"
srcdir="${src}" destdir="${bin}" srcdir="${src}" destdir="${bin}"
debug="on" debuglevel="lines,vars,source" debug="on" debuglevel="lines,vars,source"
includeantruntime="no"> includeantruntime="no" classpathref="classpath">
<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">
<compilerarg value="-Xlint:deprecation"/> <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> </javac>
</target> </target>
<!-- Build a .jar and copy to server's plugins-folder --> <!-- Build and package the project -->
<target name="dist" depends="build-src-with-deprecation-check, build-abilities"> <target name="build-package">
<delete file="${pluginname}.jar" /> <antcall target="build"/>
<jar jarfile="${pluginname}.jar"> <delete file="${ant.project.name}.jar" />
<jar jarfile="${ant.project.name}.jar">
<!-- Include the class-files (bin) and the resources (res) --> <!-- Include the class-files (bin) and the resources (res) -->
<fileset dir="${bin}" /> <fileset dir="${bin}" />
<fileset dir="${res}" /> <fileset dir="${res}" />
</jar> </jar>
<!-- Copy to server --> <antcall target="clean-bin"/>
<copy file="${pluginname}.jar" tofile="${server}/${pluginname}.jar" />
<delete dir="${ability-dest}" />
</target> </target>
<!-- Download all dependency jars from the given URLs --> <!-- Build, package and distribute the project -->
<target name="download-dependencies" depends="prepare-lib"> <target name="build-package-distribute">
<get src="${cburl}" <antcall target="build-package"/>
dest="${lib}/${cbjar}" <antcall target="copy-to-server"/>
usetimestamp="true" <antcall target="copy-to-dropbox"/>
skipexisting="true" /> </target>
<get src="${vlturl}"
dest="${lib}/${vltjar}"
usetimestamp="true"
skipexisting="true" /> <!--
<get src="${herourl}" ###########################################################################
dest="${lib}/${herojar}" ### ###
usetimestamp="true" ### Clean targets ###
skipexisting="true" /> ### ###
<get src="${spturl}" ###########################################################################
dest="${lib}/${sptjar}" -->
usetimestamp="true"
skipexisting="true" /> <!-- Delete the bin folder -->
<get src="${msurl}" <target name="clean-bin">
dest="${lib}/${msjar}" <delete dir="${bin}"/>
usetimestamp="true" </target>
skipexisting="true" />
<!-- Delete the bin folder and the jar-file -->
<target name="clean">
<antcall target="clean-bin"/>
<delete file="${ant.project.name}.jar"/>
</target> </target>
</project> </project>