html2canvas/build.xml
Obexer Christoph 16c74d1f8c Improve build system: read version from version.txt, fix build without compiler
* read the version from version.txt
 * set default target to build
 * added dependencies to all targets
 * allow the build to run without a local copy of the closure compiler
 * updated license header with @VERSION@ which will be replaced during the build
 * added the license header to all files (that one will be stripped out by the closure compiler)
2011-11-16 00:36:06 +01:00

76 lines
3.0 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="html2canvas" basedir="." default="build">
<property name="src.dir" location="src"/>
<property name="lib.dir" location="../lib"/>
<property name="build.dir" location="build"/>
<property name="dist" location="dist"/>
<property name="jquery-externs" value="jquery-1.4.4.externs.js"/>
<property name="JS_NAME" value="html2canvas.js"/>
<property name="JS_NAME_MIN" value="html2canvas.min.js"/>
<property name="JQUERY_PLUGIN_NAME" value="jquery.plugin.html2canvas.js"/>
<loadfile property="version" srcfile="version.txt" />
<fileset id="sourcefiles" dir="${src.dir}">
<include name="LICENSE"/>
<include name="Core.js"/>
<include name="Generate.js"/>
<include name="Parse.js"/>
<include name="Preload.js"/>
<include name="Queue.js"/>
<include name="Renderer.js"/>
</fileset>
<path id="jquery-plugin">
<fileset dir="${src.dir}" includes="LICENSE"/>
<fileset dir="${src.dir}/plugins" includes="${JQUERY_PLUGIN_NAME}"/>
</path>
<target name="plugins">
<concat fixlastline="yes" destfile="${build.dir}/${JQUERY_PLUGIN_NAME}">
<path refid="jquery-plugin"/>
</concat>
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JQUERY_PLUGIN_NAME}" />
</target>
<target name="build" depends="plugins">
<concat fixlastline="yes" destfile="${build.dir}/${JS_NAME}">
<fileset refid="sourcefiles"/>
</concat>
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME}" />
</target>
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
classpath="${lib.dir}/compiler.jar" onerror="report"/>
<target name="release" depends="build">
<jscomp compilationLevel="simple" warning="verbose"
debug="false"
output="${build.dir}/${JS_NAME_MIN}">
<externs dir="${lib.dir}">
<file name="${jquery-externs}"/>
</externs>
<sources dir="${src.dir}">
<!-- need to write them again here since the closure compiler doesn't understand filesets,... -->
<file name="LICENSE"/>
<file name="Core.js"/>
<file name="Generate.js"/>
<file name="Parse.js"/>
<file name="Preload.js"/>
<file name="Queue.js"/>
<file name="Renderer.js"/>
</sources>
</jscomp>
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME_MIN}" />
</target>
<target name="clean">
<delete file="${build.dir}/${JS_NAME}"></delete>
<delete file="${build.dir}/${JS_NAME_MIN}"></delete>
<delete file="${build.dir}/${JQUERY_PLUGIN_NAME}"></delete>
</target>
</project>