Simple integration of CoffeeScript support. The code uses the JavaScript implementation of the CoffeeScript compiler. All *.coffee files get compiled to JavaScript just before eval(). Additionaly a new command named /coffe is introduced to run CoffeeScript code straight in the Minecraft console.
102 lines
4 KiB
XML
102 lines
4 KiB
XML
<project name="scriptcraft" default="package" basedir=".">
|
|
<property file="build.properties"/>
|
|
<description>Builds the scriptcraft.jar file - a plugin for bukkit</description>
|
|
<property name="src" location="src/main/java"/>
|
|
<property name="build" location="target/classes"/>
|
|
<property name="dist" location="target/" />
|
|
<property name="minecraft.dir" location="${dist}/minecraft" />
|
|
|
|
<target name="init">
|
|
<property file="build.local.properties"/>
|
|
<tstamp>
|
|
<format property="DSTAMP"
|
|
pattern="yyyy-MM-dd"
|
|
locale="en,UK"/>
|
|
</tstamp>
|
|
<mkdir dir="${build}"/>
|
|
|
|
<available file="${minecraft.dir}" property="minecraft.present"/>
|
|
</target>
|
|
|
|
<target name="server-setup" depends="init" description="Downloads the latest bukkit dev jar"
|
|
unless="minecraft.present">
|
|
<mkdir dir="${minecraft.dir}" />
|
|
|
|
<echo>Retrieving CraftBukkit artifact info</echo>
|
|
<get src="http://dl.bukkit.org/api/1.0/downloads/projects/CraftBukkit?_accept=application/xml"
|
|
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"/>
|
|
|
|
<echo>Retrieving CraftBukkit jar</echo>
|
|
<get src="${bukkit.url}"
|
|
dest="${minecraft.dir}/craftbukkit.jar"
|
|
verbose="true"/>
|
|
|
|
<echo>Creating default ops.txt for your user</echo>
|
|
<echo message="${op.name}" file="${minecraft.dir}/ops.txt" />
|
|
|
|
<echo>Retrieving Coffeescript compiler</echo>
|
|
<mkdir dir="${minecraft.dir}/js-plugins/core" />
|
|
<get src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"
|
|
dest="${minecraft.dir}/js-plugins/core/_coffeescript.js"/>
|
|
</target>
|
|
|
|
<target name="run" depends="server-setup, package, update-live-cb" description="Starts Bukkit with ScriptCraft">
|
|
<echo>Starting Bukkit with ScriptCraft</echo>
|
|
<java jar="${minecraft.dir}/craftbukkit.jar"
|
|
maxmemory="1024m"
|
|
fork="true"
|
|
dir="${minecraft.dir}"
|
|
/>
|
|
</target>
|
|
|
|
<target name="compile" depends="init, server-setup" description="compile bukkit plugin source">
|
|
<javac includeantruntime="false" srcdir="${src}" destdir="${build}" classpath="${minecraft.dir}/craftbukkit.jar" />
|
|
</target>
|
|
|
|
<target name="gendocs" depends="init" description="Generate API documentation">
|
|
<javac includeantruntime="false" srcdir="src/docs/java"/>
|
|
<java classname="jscript" failonerror="true" fork="true" output="docs/api.md">
|
|
<classpath>
|
|
<pathelement path="src/docs/java"/>
|
|
</classpath>
|
|
<arg value="src/docs/javascript/generateApiDocs.js"/>
|
|
<arg value="src/main/javascript"/>
|
|
</java>
|
|
</target>
|
|
|
|
<target name="zip_js" depends="init">
|
|
<zip zipfile="${build}/js-plugins.zip" basedir="./src/main/javascript"/>
|
|
</target>
|
|
|
|
<target name="package" depends="gendocs,zip_js,compile"
|
|
description="generate the distribution" >
|
|
<!-- ensure plugin.yml is always copied -->
|
|
<delete file="${build}/plugin.yml" />
|
|
<copy file="src/main/resources/plugin.yml" todir="${build}"/>
|
|
<replace file="${build}/plugin.yml" value="${bukkit-version}-${DSTAMP}">
|
|
<replacetoken>[[version]]</replacetoken>
|
|
</replace>
|
|
|
|
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
|
|
<mkdir dir="${dist}/${DSTAMP}" />
|
|
<jar jarfile="${dist}/${DSTAMP}/ScriptCraft.jar" basedir="${build}"/>
|
|
</target>
|
|
|
|
<target name="clean" description="clean up" >
|
|
<delete dir="${dist}"/>
|
|
</target>
|
|
|
|
<target name="update-live-cb" depends="package" description="Copy the built plugin to the live craftbukkit folder for testing.">
|
|
<mkdir dir="${minecraft.dir}/plugins" />
|
|
<delete>
|
|
<fileset dir="${minecraft.dir}/plugins/" includes="scriptcraft*.*"/>
|
|
</delete>
|
|
<mkdir dir="${minecraft.dir}/plugins" />
|
|
<copy file="${dist}/${DSTAMP}/ScriptCraft.jar" todir="${minecraft.dir}/plugins"/>
|
|
</target>
|
|
</project>
|