This repository has been archived on 2021-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
scriptcraft/build.xml

206 lines
7.2 KiB
XML
Raw Normal View History

<project name="scriptcraft" default="package" basedir=".">
<property file="build.properties"/>
2013-10-21 21:24:29 +02:00
<description>Builds the scriptcraft.jar file - a plugin for bukkit</description>
<property name="src.canary" location="src/main/java/canary"/>
<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'" />
<target name="init">
2013-06-03 01:02:28 +02:00
<property file="build.local.properties"/>
<tstamp>
<format property="DSTAMP"
pattern="yyyy-MM-dd"
locale="en,UK"/>
</tstamp>
<mkdir dir="${build}"/>
2013-06-03 01:02:28 +02:00
<available file="${minecraft.dir}" property="minecraft.present"/>
<available file="${dist}/js/modules/underscore.js" property="underscore.present"/>
2013-06-03 01:02:28 +02:00
</target>
<target name="test" depends="package" description="Perform unit tests">
</target>
<target name="compile-canary" depends="init" description="compile canary plugin source">
<javac includeantruntime="false"
srcdir="${src.canary}"
source="1.6"
target="1.6"
destdir="${build}"
2014-01-31 02:38:27 +01:00
debug="true"
classpath="lib/canary.jar" />
</target>
<target name="gendocs" depends="construct-ypgpm, construct-api-ref" description="Generate API documentation">
</target>
<target name="compile-docs" depends="init">
2014-04-26 23:09:54 +02:00
<javac includeantruntime="false"
srcdir="src/docs/java"
destdir="${build}"
/>
</target>
<target name="generate-api-ref-entries" depends="copy-js,compile-docs,init">
<java classname="jscript" failonerror="true" fork="true" output="${dist}/apiref.md">
2013-02-08 22:23:15 +01:00
<classpath>
2014-04-26 23:09:54 +02:00
<pathelement path="${build}"/>
2013-02-08 22:23:15 +01:00
</classpath>
<arg value="src/docs/js/generateApiDocs.js"/>
<arg value="${dist}/js"/>
2013-02-08 22:23:15 +01:00
</java>
</target>
<target name="gen-events-helper-canary" depends="compile-docs,init">
<mkdir dir="${dist}/js/lib"/>
<java classname="jscript" failonerror="true" fork="true" output="${dist}/js/lib/events-helper.js" error="${dist}/geneventserror.log">
<classpath>
<pathelement path="${build}"/>
<pathelement path="lib/canary.jar"/>
</classpath>
<arg value="src/generateEventsHelper.js"/>
<arg value="canary"/>
<arg value="lib/canary.jar"/>
<arg value="blockDestroy"/>
<arg value="net.canarymod.hook.player.BlockDestroyHook"/>
</java>
</target>
<target name="gen-events-helper-bukkit" depends="compile-docs,init">
<mkdir dir="${dist}/js/lib"/>
<java classname="jscript" failonerror="true" fork="true" output="${dist}/js/lib/events-helper.js" error="${dist}/geneventserror.log">
<classpath>
2014-04-26 23:09:54 +02:00
<pathelement path="${build}"/>
<pathelement path="lib/canary.jar"/>
</classpath>
<arg value="src/generateEventsHelper.js"/>
<arg value="canary"/>
<arg value="lib/canary.jar"/>
<arg value="Break"/>
<arg value="org.bukkit.event.block.BlockBreakEvent"/>
</java>
</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>
<target name="gen-toc-apiref" depends="compile-docs,generate-api-ref-entries, init" description="Generate Table of Contents for API Reference">
<java classname="jscript" failonerror="true" fork="true" output="${dist}/toc-apiref.md">
<classpath>
2014-04-26 23:09:54 +02:00
<pathelement path="${build}"/>
</classpath>
<arg value="src/docs/js/generateTOC.js"/>
<arg value="${dist}/apiref.md"/>
</java>
2013-02-08 22:23:15 +01:00
</target>
<target name="gen-toc-ypgpm" depends="compile-docs,init" description="Generate Table of Contents for Young Programmers Guide">
<java classname="jscript" failonerror="true" fork="true" output="${dist}/toc-ypgpm.md">
<classpath>
2014-04-26 23:09:54 +02:00
<pathelement path="${build}"/>
</classpath>
<arg value="src/docs/js/generateTOC.js"/>
<arg value="src/docs/templates/ypgpm.md"/>
</java>
</target>
<!-- Piece together the Young persons' guide from template and generated table of contents -->
<target name="construct-ypgpm" depends="gen-toc-ypgpm,init">
<concat destfile="docs/YoungPersonsGuideToProgrammingMinecraft.md">
<header filtering="no" trimleading="yes"># The Young Person's Guide to Programming in Minecraft
</header>
<fileset file="${dist}/toc-ypgpm.md" />
<fileset file="src/docs/templates/ypgpm.md" />
</concat>
</target>
<target name="zip_js" depends="zip_lib, zip_modules, zip_plugins">
</target>
<target name="copy-js" depends="gen-events-helper-canary,init">
<copy todir="${dist}/js">
<fileset dir="src/main/js"/>
</copy>
</target>
<target name="zip_lib" depends="copy-js">
<delete file="${build}/lib.zip"/>
<zip destfile="${build}/lib.zip"
basedir="${dist}/js"
excludes="modules/**, plugins/**,">
</zip>
</target>
<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">
<delete file="${build}/modules.zip"/>
<zip destfile="${build}/modules.zip"
basedir="${dist}/js"
excludes="lib/**, plugins/**,">
</zip>
</target>
<target name="zip_plugins" depends="copy-js">
<delete file="${build}/plugins.zip"/>
<zip destfile="${build}/plugins.zip"
basedir="${dist}/js"
excludes="lib/**, modules/**">
</zip>
</target>
<target name="package" depends="gendocs,zip_js,compile-canary" description="generate the distribution" >
<!-- ensure plugin.yml is always copied -->
<delete file="${build}/plugin.yml" />
<copy todir="${build}">
<fileset dir="src/main/resources"/>
</copy>
<replace file="${build}/plugin.yml" value="${scriptcraft-version}-${DSTAMP}">
2013-10-21 21:24:29 +02:00
<replacetoken>[[version]]</replacetoken>
</replace>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
2013-06-03 01:02:28 +02:00
<mkdir dir="${dist}/${DSTAMP}" />
<jar jarfile="${dist}/${DSTAMP}/scriptcraft.jar" basedir="${build}"/>
<copy file="${dist}/${DSTAMP}/scriptcraft.jar" tofile="${dist}/scriptcraft.jar"/>
</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 folder for testing.">
2013-06-03 01:02:28 +02:00
<mkdir dir="${minecraft.dir}/plugins" />
<delete>
2013-06-03 01:02:28 +02:00
<fileset dir="${minecraft.dir}/plugins/" includes="scriptcraft*.*"/>
</delete>
2013-06-03 01:02:28 +02:00
<mkdir dir="${minecraft.dir}/plugins" />
<copy file="${dist}/${DSTAMP}/scriptcraft.jar" todir="${minecraft.dir}/plugins"/>
</target>
</project>