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>
2014-11-09 09:24:34 +01:00
<!-- ScriptCraft works with:
* CanaryMod
* Bukkit
* Glowstone (which is bukkit-compatible)
2015-01-03 14:17:58 +01:00
* Spigot (which is bukkit-compatible)
2014-11-09 09:24:34 +01:00
-->
2014-09-30 00:42:41 +02:00
<property name= "src.canary" location= "src/main/java/canary" />
2014-10-18 12:05:30 +02:00
<property name= "src.bukkit" location= "src/main/java/bukkit" />
2014-11-09 09:24:34 +01:00
<!-- compiles against these libraries -->
2015-01-17 21:14:59 +01:00
<property name= "lib.canary" location= "target/lib/canarymod.jar" />
2014-11-09 12:52:10 +01:00
<property name= "lib.bukkit" location= "lib/bukkit-1.7.10-R0.1-SNAPSHOT.jar" />
2014-11-09 09:24:34 +01:00
2013-01-22 00:11:28 +01:00
<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'" />
2014-10-18 19:48:57 +02:00
<macrodef name= "jscript" >
<attribute name= "src" />
<attribute name= "out" />
<attribute name= "err" />
<element name= "js-args" implicit= "yes" optional= "true" />
<sequential >
<java classname= "jscript" failonerror= "true" fork= "true" output= "@{out}" error= "@{err}" >
<classpath >
<pathelement path= "${build}" />
<pathelement path= "${lib.canary}" />
2014-11-09 12:52:10 +01:00
<pathelement path= "${lib.bukkit}" />
2014-10-18 19:48:57 +02:00
</classpath>
<arg value= "@{src}" />
<js-args />
</java>
</sequential>
</macrodef>
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
2015-01-17 21:14:59 +01:00
<available file= "${lib.canary}" property= "canary.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
2015-01-17 21:14:59 +01:00
<target name= "get-canary" depends= "init" description= "Downloads canarymod jar" unless= "canary.present" >
<get src= "https://ci.visualillusionsent.net/job/CanaryMod/lastStableBuild/artifact/*zip*/archive.zip"
dest="target/canarymod.zip"
verbose="true"/>
<unzip src= "target/canarymod.zip"
dest="target/lib">
<mapper type= "glob" from= "*.jar" to= "canarymod.jar" />
</unzip>
</target>
<target name= "compile-plugins" depends= "init,get-canary" description= "compile canary plugin source" >
2014-01-18 00:05:36 +01:00
<javac includeantruntime= "false"
source="1.6"
target="1.6"
destdir="${build}"
2014-10-18 12:05:30 +02:00
debug="true">
<src path= "${src.canary}" />
<src path= "${src.bukkit}" />
<classpath >
2014-10-18 19:48:57 +02:00
<pathelement path= "${lib.canary}" />
2014-11-09 09:24:34 +01:00
<pathelement path= "${lib.bukkit}" />
2014-10-18 12:05:30 +02:00
</classpath>
</javac>
2013-01-13 18:00:30 +01:00
</target>
2013-01-22 00:11:28 +01:00
2015-01-17 21:14:59 +01:00
<target name= "gendocs" depends= "construct-ypgpm, construct-api-ref, get-canary" description= "Generate API documentation" >
2014-01-04 19:39:49 +01:00
</target>
2015-01-17 21:14:59 +01:00
<target name= "compile-docs" depends= "init, get-canary" >
2014-10-18 19:48:57 +02:00
<javac includeantruntime= "false" srcdir= "src/docs/java" destdir= "${build}" >
2013-02-08 22:23:15 +01:00
<classpath >
2014-10-18 19:48:57 +02:00
<pathelement path= "${lib.canary}" />
2013-02-08 22:23:15 +01:00
</classpath>
2014-10-18 19:48:57 +02:00
</javac>
</target>
2014-10-12 19:34:40 +02:00
2015-01-17 21:14:59 +01:00
<target name= "generate-api-ref-entries" depends= "copy-js,compile-docs,init,get-canary" >
2014-10-12 19:34:40 +02:00
2014-11-09 12:52:10 +01:00
<jscript src= "src/docs/js/generateApiDocs.js"
out="${dist}/apiref.md"
err="${dist}/gen-api-error.log">
2014-10-18 19:48:57 +02:00
<arg value= "${dist}/js" />
</jscript>
2014-11-09 12:52:10 +01:00
<jscript src= "src/docs/js/generateItemsDoc.js"
out="${dist}/items.md"
err="${dist}/gen-items-error.log" />
2014-10-05 18:29:04 +02:00
<concat destfile= "${dist}/apiref-con.md" >
<fileset file= "${dist}/apiref.md" />
<fileset file= "${dist}/items.md" />
</concat>
2014-10-12 19:34:40 +02:00
2014-01-04 19:39:49 +01:00
</target>
2015-01-17 21:14:59 +01:00
<target name= "gen-events-helper-canary" depends= "compile-docs,init, get-canary" >
2014-09-30 00:42:41 +02:00
<mkdir dir= "${dist}/js/lib" />
2014-11-09 12:52:10 +01:00
<jscript src= "src/docs/js/generateEventsHelper.js"
out="${dist}/js/lib/events-helper-canary.js"
err="${dist}/gen-events-canary-error.log">
2014-09-30 00:42:41 +02:00
<arg value= "canary" />
2014-10-18 19:48:57 +02:00
<arg value= "${lib.canary}" />
2014-09-30 00:42:41 +02:00
<arg value= "blockDestroy" />
<arg value= "net.canarymod.hook.player.BlockDestroyHook" />
2014-10-18 19:48:57 +02:00
</jscript>
2014-09-30 00:42:41 +02:00
</target>
2015-01-17 21:14:59 +01:00
<target name= "gen-events-helper-bukkit" depends= "compile-docs,init,get-canary" >
2014-04-26 17:56:57 +02:00
<mkdir dir= "${dist}/js/lib" />
2014-11-09 12:52:10 +01:00
<jscript src= "src/docs/js/generateEventsHelper.js"
out="${dist}/js/lib/events-helper-bukkit.js"
err="${dist}/gen-events-bukkit-error.log">
2014-10-18 19:48:57 +02:00
<arg value= "bukkit" />
2014-11-09 12:52:10 +01:00
<arg value= "${lib.bukkit}" />
<arg value= "blockBreak" />
2014-09-30 00:42:41 +02:00
<arg value= "org.bukkit.event.block.BlockBreakEvent" />
2014-10-18 19:48:57 +02:00
</jscript>
2014-04-26 17:56:57 +02:00
</target>
2014-01-04 19:39:49 +01:00
<target name= "construct-api-ref" depends= "gen-toc-apiref,init" >
<concat destfile= "docs/API-Reference.md" >
2015-01-11 01:11:44 +01:00
<header filtering= "no" trimleading= "yes" > < !--
IMPORTANT NOTE FOR CONTRIBUTORS
-------------------------------
Contributors: This file is generated from comments in javascript source files src/main/js/*
If you would like to make changes, change the comments in the src/main/js/* files instead.
-->
# ScriptCraft API Reference
2014-01-04 19:39:49 +01:00
Walter Higgins
[walter.higgins@gmail.com][email]
[email]: mailto:walter.higgins@gmail.com?subject=ScriptCraft_API_Reference
</header>
<fileset file= "${dist}/toc-apiref.md" />
2014-10-05 18:29:04 +02:00
<fileset file= "${dist}/apiref-con.md" />
2014-01-04 19:39:49 +01:00
</concat>
</target>
2014-10-18 19:48:57 +02:00
2015-01-17 21:14:59 +01:00
<target name= "gen-toc-apiref" depends= "compile-docs,generate-api-ref-entries, init, get-canary" description= "Generate Table of Contents for API Reference" >
2014-11-09 12:52:10 +01:00
<jscript src= "src/docs/js/generateTOC.js"
out="${dist}/toc-apiref.md"
err="${dist}/gen-toc-error.log">
2014-10-05 18:29:04 +02:00
<arg value= "${dist}/apiref-con.md" />
2014-10-18 19:48:57 +02:00
</jscript>
2013-02-08 22:23:15 +01:00
</target>
2013-01-15 22:11:18 +01:00
2015-01-17 21:14:59 +01:00
<target name= "gen-toc-ypgpm" depends= "compile-docs,init, get-canary" description= "Generate Table of Contents for Young Programmers Guide" >
2014-11-09 12:52:10 +01:00
<jscript src= "src/docs/js/generateTOC.js"
out="${dist}/toc-ypgpm.md"
err="${dist}/gen-ypgpm-error.log">
2014-01-14 00:01:17 +01:00
<arg value= "src/docs/templates/ypgpm.md" />
2014-10-18 19:48:57 +02:00
</jscript>
2014-01-04 17:57:43 +01:00
</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" >
2015-01-11 01:11:44 +01:00
<header filtering= "no" trimleading= "yes" > < !--
IMPORTANT NOTE FOR CONTRIBUTORS
-------------------------------
Contributors: This file is generated from source file src/docs/templates/ypgpm.md
If you would like to make changes, change file src/docs/templates/ypgpm.md instead
-->
# The Young Person's Guide to Programming in Minecraft
2014-01-04 17:57:43 +01:00
</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-11-09 12:52:10 +01:00
<target name= "copy-js" depends= "gen-events-helper-canary,gen-events-helper-bukkit,init" >
2014-01-30 00:11:40 +01:00
<copy todir= "${dist}/js" >
<fileset dir= "src/main/js" />
</copy>
</target>
2014-04-26 17:56:57 +02:00
<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-04-26 17:56:57 +02:00
<target name= "get_underscore" depends= "copy-js" unless= "underscore.present" >
2014-01-30 00:11:40 +01:00
<!-- download underscore -->
<get src= "http://underscorejs.org/underscore.js"
verbose="true"
dest="${dist}/js/modules/underscore.js"/>
</target>
2014-04-26 17:56:57 +02:00
<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-04-26 17:56:57 +02: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>
2014-10-18 12:05:30 +02:00
<target name= "package" depends= "gendocs,zip_js,compile-plugins" description= "generate the distribution" >
2013-02-19 20:09:03 +01:00
<!-- ensure plugin.yml is always copied -->
<delete file= "${build}/plugin.yml" />
2014-11-14 20:57:48 +01:00
<delete file= "${build}/Canary.inf" />
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>
2014-11-14 20:57:48 +01:00
<replace file= "${build}/Canary.inf" value= "${scriptcraft-version}-${DSTAMP}" >
<replacetoken > [[version]]</replacetoken>
</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>
2014-09-30 00:42:41 +02:00
<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" />
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>