2013-01-22 00:11:28 +01:00
|
|
|
<project name="scriptcraft" default="package" basedir=".">
|
2013-01-13 18:00:30 +01:00
|
|
|
<property file="build.properties"/>
|
2013-10-21 21:24:29 +02:00
|
|
|
<description>Builds the scriptcraft.jar file - a plugin for bukkit</description>
|
2013-01-22 00:11:28 +01:00
|
|
|
<property name="src" location="src/main/java"/>
|
|
|
|
<property name="build" location="target/classes"/>
|
|
|
|
<property name="dist" location="target/" />
|
2013-06-03 01:02:28 +02:00
|
|
|
<property name="minecraft.dir" location="${dist}/minecraft" />
|
2013-12-24 01:11:08 +01:00
|
|
|
<property name="js-plugins-dir" value="scriptcraft"/>
|
2013-10-21 21:24:29 +02:00
|
|
|
<property name="http.agent" value="'Walter'" />
|
2013-01-13 18:00:30 +01:00
|
|
|
<target name="init">
|
2013-06-03 01:02:28 +02:00
|
|
|
<property file="build.local.properties"/>
|
2013-02-22 17:51:01 +01:00
|
|
|
<tstamp>
|
|
|
|
<format property="DSTAMP"
|
|
|
|
pattern="yyyy-MM-dd"
|
|
|
|
locale="en,UK"/>
|
|
|
|
</tstamp>
|
2013-01-22 00:11:28 +01:00
|
|
|
<mkdir dir="${build}"/>
|
2013-06-03 01:02:28 +02:00
|
|
|
|
|
|
|
<available file="${minecraft.dir}" property="minecraft.present"/>
|
2014-01-30 00:11:40 +01:00
|
|
|
<available file="${dist}/js/modules/underscore.js" property="underscore.present"/>
|
2013-06-03 01:02:28 +02:00
|
|
|
</target>
|
|
|
|
|
2014-01-14 23:54:49 +01:00
|
|
|
<target name="test" depends="package" description="Perform unit tests">
|
|
|
|
|
|
|
|
</target>
|
2014-01-18 00:05:36 +01:00
|
|
|
|
2014-01-30 00:11:40 +01:00
|
|
|
|
2013-06-03 01:02:28 +02:00
|
|
|
<target name="server-setup" depends="init" description="Downloads the latest bukkit dev jar"
|
|
|
|
unless="minecraft.present">
|
|
|
|
<mkdir dir="${minecraft.dir}" />
|
2013-08-11 23:15:19 +02:00
|
|
|
|
2013-10-21 21:24:29 +02:00
|
|
|
<echo>Retrieving CraftBukkit artifact info</echo>
|
|
|
|
<get src="http://dl.bukkit.org/api/1.0/downloads/projects/CraftBukkit/?_accept=application/xml"
|
|
|
|
verbose="true"
|
|
|
|
httpusecaches="false"
|
2013-06-03 01:02:28 +02:00
|
|
|
dest="${minecraft.dir}/bukkit.xml" />
|
|
|
|
|
|
|
|
<xslt in="${minecraft.dir}/bukkit.xml"
|
|
|
|
out="${minecraft.dir}/ant.properties.xml"
|
|
|
|
style="build/bukkit-to-url.xsl"/>
|
|
|
|
<xmlproperty file="${minecraft.dir}/ant.properties.xml" keeproot="true"/>
|
|
|
|
|
2013-10-21 21:24:29 +02:00
|
|
|
<echo>Retrieving CraftBukkit jar</echo>
|
2013-06-03 01:02:28 +02:00
|
|
|
<get src="${bukkit.url}"
|
|
|
|
dest="${minecraft.dir}/craftbukkit.jar"
|
|
|
|
verbose="true"/>
|
|
|
|
|
2013-10-21 21:24:29 +02:00
|
|
|
<echo>Creating default ops.txt for your user</echo>
|
2013-06-03 01:02:28 +02:00
|
|
|
<echo message="${op.name}" file="${minecraft.dir}/ops.txt" />
|
2013-08-11 23:15:19 +02:00
|
|
|
|
2013-06-03 01:02:28 +02:00
|
|
|
</target>
|
|
|
|
|
2013-08-11 23:15:19 +02:00
|
|
|
|
2013-06-03 01:02:28 +02:00
|
|
|
<target name="run" depends="server-setup, package, update-live-cb" description="Starts Bukkit with ScriptCraft">
|
2013-10-21 21:24:29 +02:00
|
|
|
<echo>Starting Bukkit with ScriptCraft</echo>
|
|
|
|
<java jar="${minecraft.dir}/craftbukkit.jar" maxmemory="1024m" fork="true" dir="${minecraft.dir}" />
|
2013-01-13 18:00:30 +01:00
|
|
|
</target>
|
|
|
|
|
2013-06-03 01:02:28 +02:00
|
|
|
<target name="compile" depends="init, server-setup" description="compile bukkit plugin source">
|
2014-01-18 00:05:36 +01:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
srcdir="${src}"
|
|
|
|
source="1.6"
|
|
|
|
target="1.6"
|
|
|
|
destdir="${build}"
|
2014-01-31 02:38:27 +01:00
|
|
|
debug="true"
|
2014-01-18 00:05:36 +01:00
|
|
|
classpath="${minecraft.dir}/craftbukkit.jar" />
|
2013-01-13 18:00:30 +01:00
|
|
|
</target>
|
2013-01-22 00:11:28 +01:00
|
|
|
|
2014-01-04 19:39:49 +01:00
|
|
|
<target name="gendocs" depends="construct-ypgpm, construct-api-ref" description="Generate API documentation">
|
|
|
|
</target>
|
|
|
|
|
2014-01-05 13:23:09 +01:00
|
|
|
<target name="compile-docs" depends="init">
|
2013-02-19 20:09:03 +01:00
|
|
|
<javac includeantruntime="false" srcdir="src/docs/java"/>
|
2014-01-05 13:23:09 +01:00
|
|
|
</target>
|
2014-01-04 19:39:49 +01:00
|
|
|
|
2014-01-05 13:23:09 +01:00
|
|
|
<target name="generate-api-ref-entries" depends="compile-docs,init">
|
2014-01-04 19:39:49 +01:00
|
|
|
<java classname="jscript" failonerror="true" fork="true" output="${dist}/apiref.md">
|
2013-02-08 22:23:15 +01:00
|
|
|
<classpath>
|
|
|
|
<pathelement path="src/docs/java"/>
|
|
|
|
</classpath>
|
2014-01-25 10:04:16 +01:00
|
|
|
<arg value="src/docs/js/generateApiDocs.js"/>
|
|
|
|
<arg value="src/main/js"/>
|
2013-02-08 22:23:15 +01:00
|
|
|
</java>
|
2014-01-04 19:39:49 +01:00
|
|
|
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="construct-api-ref" depends="gen-toc-apiref,init">
|
|
|
|
|
|
|
|
<concat destfile="docs/API-Reference.md">
|
|
|
|
<header filtering="no" trimleading="yes"># ScriptCraft API Reference
|
|
|
|
|
|
|
|
Walter Higgins
|
|
|
|
|
|
|
|
[walter.higgins@gmail.com][email]
|
|
|
|
|
|
|
|
[email]: mailto:walter.higgins@gmail.com?subject=ScriptCraft_API_Reference
|
|
|
|
|
|
|
|
</header>
|
|
|
|
<fileset file="${dist}/toc-apiref.md" />
|
|
|
|
<fileset file="${dist}/apiref.md" />
|
|
|
|
</concat>
|
|
|
|
</target>
|
|
|
|
|
2014-01-05 13:23:09 +01:00
|
|
|
<target name="gen-toc-apiref" depends="compile-docs,generate-api-ref-entries, init" description="Generate Table of Contents for API Reference">
|
2014-01-04 19:39:49 +01:00
|
|
|
<java classname="jscript" failonerror="true" fork="true" output="${dist}/toc-apiref.md">
|
|
|
|
<classpath>
|
|
|
|
<pathelement path="src/docs/java"/>
|
|
|
|
</classpath>
|
2014-01-25 10:04:16 +01:00
|
|
|
<arg value="src/docs/js/generateTOC.js"/>
|
2014-01-04 19:39:49 +01:00
|
|
|
<arg value="${dist}/apiref.md"/>
|
|
|
|
</java>
|
2013-02-08 22:23:15 +01:00
|
|
|
</target>
|
2013-01-15 22:11:18 +01:00
|
|
|
|
2014-01-05 13:23:09 +01:00
|
|
|
<target name="gen-toc-ypgpm" depends="compile-docs,init" description="Generate Table of Contents for Young Programmers Guide">
|
2014-01-04 19:39:49 +01:00
|
|
|
<java classname="jscript" failonerror="true" fork="true" output="${dist}/toc-ypgpm.md">
|
2014-01-04 17:57:43 +01:00
|
|
|
<classpath>
|
|
|
|
<pathelement path="src/docs/java"/>
|
|
|
|
</classpath>
|
2014-01-25 10:04:16 +01:00
|
|
|
<arg value="src/docs/js/generateTOC.js"/>
|
2014-01-14 00:01:17 +01:00
|
|
|
<arg value="src/docs/templates/ypgpm.md"/>
|
2014-01-04 17:57:43 +01:00
|
|
|
</java>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Piece together the Young persons' guide from template and generated table of contents -->
|
2014-01-04 19:39:49 +01:00
|
|
|
<target name="construct-ypgpm" depends="gen-toc-ypgpm,init">
|
2014-01-04 17:57:43 +01:00
|
|
|
<concat destfile="docs/YoungPersonsGuideToProgrammingMinecraft.md">
|
|
|
|
<header filtering="no" trimleading="yes"># The Young Person's Guide to Programming in Minecraft
|
|
|
|
</header>
|
2014-01-04 19:39:49 +01:00
|
|
|
<fileset file="${dist}/toc-ypgpm.md" />
|
2014-01-14 00:01:17 +01:00
|
|
|
<fileset file="src/docs/templates/ypgpm.md" />
|
2014-01-04 17:57:43 +01:00
|
|
|
</concat>
|
|
|
|
</target>
|
2013-08-11 23:15:19 +02:00
|
|
|
|
2014-01-14 23:54:49 +01:00
|
|
|
<target name="zip_js" depends="zip_lib, zip_modules, zip_plugins">
|
|
|
|
</target>
|
|
|
|
|
2014-01-30 00:11:40 +01:00
|
|
|
<target name="copy_js" depends="init">
|
|
|
|
<copy todir="${dist}/js">
|
|
|
|
<fileset dir="src/main/js"/>
|
|
|
|
</copy>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="zip_lib" depends="copy_js">
|
2014-01-14 23:54:49 +01:00
|
|
|
<delete file="${build}/lib.zip"/>
|
|
|
|
<zip destfile="${build}/lib.zip"
|
2014-01-30 00:11:40 +01:00
|
|
|
basedir="${dist}/js"
|
2014-01-14 23:54:49 +01:00
|
|
|
excludes="modules/**, plugins/**,">
|
|
|
|
</zip>
|
|
|
|
</target>
|
|
|
|
|
2014-01-30 00:11:40 +01:00
|
|
|
<target name="get_underscore" depends="copy_js" unless="underscore.present">
|
|
|
|
<!-- download underscore -->
|
|
|
|
<get src="http://underscorejs.org/underscore.js"
|
|
|
|
verbose="true"
|
|
|
|
dest="${dist}/js/modules/underscore.js"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="zip_modules" depends="copy_js, get_underscore">
|
2014-01-14 23:54:49 +01:00
|
|
|
<delete file="${build}/modules.zip"/>
|
|
|
|
<zip destfile="${build}/modules.zip"
|
2014-01-30 00:11:40 +01:00
|
|
|
basedir="${dist}/js"
|
2014-01-14 23:54:49 +01:00
|
|
|
excludes="lib/**, plugins/**,">
|
2013-08-11 23:15:19 +02:00
|
|
|
</zip>
|
2013-01-13 18:00:30 +01:00
|
|
|
</target>
|
|
|
|
|
2014-01-30 00:11:40 +01:00
|
|
|
<target name="zip_plugins" depends="copy_js">
|
2014-01-14 23:54:49 +01:00
|
|
|
<delete file="${build}/plugins.zip"/>
|
|
|
|
<zip destfile="${build}/plugins.zip"
|
2014-01-30 00:11:40 +01:00
|
|
|
basedir="${dist}/js"
|
2014-01-14 23:54:49 +01:00
|
|
|
excludes="lib/**, modules/**">
|
|
|
|
</zip>
|
|
|
|
</target>
|
|
|
|
|
2013-10-21 21:24:29 +02:00
|
|
|
<target name="package" depends="gendocs,zip_js,compile" description="generate the distribution" >
|
2013-02-19 20:09:03 +01:00
|
|
|
<!-- ensure plugin.yml is always copied -->
|
|
|
|
<delete file="${build}/plugin.yml" />
|
2014-01-14 23:54:49 +01:00
|
|
|
<copy todir="${build}">
|
|
|
|
<fileset dir="src/main/resources"/>
|
|
|
|
</copy>
|
2013-12-25 08:48:10 +01:00
|
|
|
<replace file="${build}/plugin.yml" value="${scriptcraft-version}-${DSTAMP}">
|
2013-10-21 21:24:29 +02:00
|
|
|
<replacetoken>[[version]]</replacetoken>
|
2013-01-22 00:11:28 +01:00
|
|
|
</replace>
|
2013-02-19 20:09:03 +01:00
|
|
|
|
2013-01-13 18:00:30 +01:00
|
|
|
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
|
2013-06-03 01:02:28 +02:00
|
|
|
<mkdir dir="${dist}/${DSTAMP}" />
|
2014-01-18 00:05:36 +01:00
|
|
|
|
2014-01-12 12:26:26 +01:00
|
|
|
<jar jarfile="${dist}/${DSTAMP}/scriptcraft.jar" basedir="${build}"/>
|
2014-01-30 00:11:40 +01:00
|
|
|
<copy file="${dist}/${DSTAMP}/scriptcraft.jar" tofile="${dist}/scriptcraft.jar"/>
|
2013-01-13 18:00:30 +01:00
|
|
|
</target>
|
2013-01-14 23:55:39 +01:00
|
|
|
|
2013-01-13 18:00:30 +01:00
|
|
|
<target name="clean" description="clean up" >
|
2013-01-22 00:11:28 +01:00
|
|
|
<delete dir="${dist}"/>
|
2013-01-13 18:00:30 +01:00
|
|
|
</target>
|
|
|
|
|
2013-01-22 00:11:28 +01:00
|
|
|
<target name="update-live-cb" depends="package" description="Copy the built plugin to the live craftbukkit folder for testing.">
|
2013-06-03 01:02:28 +02:00
|
|
|
<mkdir dir="${minecraft.dir}/plugins" />
|
2013-01-22 00:11:28 +01:00
|
|
|
<delete>
|
2013-06-03 01:02:28 +02:00
|
|
|
<fileset dir="${minecraft.dir}/plugins/" includes="scriptcraft*.*"/>
|
2013-01-22 00:11:28 +01:00
|
|
|
</delete>
|
2013-06-03 01:02:28 +02:00
|
|
|
<mkdir dir="${minecraft.dir}/plugins" />
|
2014-01-12 12:26:26 +01:00
|
|
|
<copy file="${dist}/${DSTAMP}/scriptcraft.jar" todir="${minecraft.dir}/plugins"/>
|
2013-01-14 23:55:39 +01:00
|
|
|
</target>
|
2013-01-13 18:00:30 +01:00
|
|
|
</project>
|