|
1 | 1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
2 | | -<project name="html2canvas" basedir="."> |
| 2 | +<project name="html2canvas" basedir="." default="build"> |
3 | 3 | <property name="src.dir" location="src"/> |
4 | 4 | <property name="lib.dir" location="../lib"/> |
5 | 5 | <property name="build.dir" location="build"/> |
6 | 6 | <property name="dist" location="dist"/> |
7 | | - |
8 | | - |
9 | 7 | <property name="jquery-externs" value="jquery-1.4.4.externs.js"/> |
10 | | - |
11 | | - |
| 8 | + |
12 | 9 | <property name="JS_NAME" value="html2canvas.js"/> |
13 | 10 | <property name="JS_NAME_MIN" value="html2canvas.min.js"/> |
14 | 11 | <property name="JQUERY_PLUGIN_NAME" value="jquery.plugin.html2canvas.js"/> |
15 | | - |
| 12 | + <loadfile property="version" srcfile="version.txt" /> |
16 | 13 |
|
17 | | - <path id="sourcefiles"> |
18 | | - <fileset dir="${src.dir}" includes="LICENSE"/> |
19 | | - <fileset dir="." includes="LICENSE"/> |
20 | | - <fileset dir="${src.dir}" includes="Core.js"/> |
21 | | - <fileset dir="${src.dir}" includes="Generate.js"/> |
22 | | - <fileset dir="${src.dir}" includes="Parse.js"/> |
23 | | - <fileset dir="${src.dir}" includes="Preload.js"/> |
24 | | - <fileset dir="${src.dir}" includes="Queue.js"/> |
25 | | - <fileset dir="${src.dir}" includes="Renderer.js"/> |
| 14 | + <fileset id="sourcefiles" dir="${src.dir}"> |
| 15 | + <include name="LICENSE"/> |
| 16 | + <include name="Core.js"/> |
| 17 | + <include name="Generate.js"/> |
| 18 | + <include name="Parse.js"/> |
| 19 | + <include name="Preload.js"/> |
| 20 | + <include name="Queue.js"/> |
| 21 | + <include name="Renderer.js"/> |
| 22 | + </fileset> |
26 | 23 |
|
27 | | - |
28 | | - </path> |
29 | | - |
30 | 24 | <path id="jquery-plugin"> |
31 | 25 | <fileset dir="${src.dir}" includes="LICENSE"/> |
32 | | - <fileset dir="." includes="LICENSE"/> |
33 | 26 | <fileset dir="${src.dir}/plugins" includes="${JQUERY_PLUGIN_NAME}"/> |
34 | 27 | </path> |
35 | | - |
36 | | - <path id="minified"> |
37 | | - <fileset dir="${src.dir}" includes="LICENSE"/> |
38 | | - <fileset dir="${build.dir}" includes="tmp.js"/> |
39 | | - </path> |
40 | | - |
| 28 | + |
41 | 29 | <target name="plugins"> |
42 | 30 | <concat fixlastline="yes" destfile="${build.dir}/${JQUERY_PLUGIN_NAME}"> |
43 | 31 | <path refid="jquery-plugin"/> |
44 | 32 | </concat> |
| 33 | + <replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JQUERY_PLUGIN_NAME}" /> |
45 | 34 | </target> |
46 | | - |
47 | | - |
48 | | - <target name="build"> |
| 35 | + |
| 36 | + |
| 37 | + <target name="build" depends="plugins"> |
49 | 38 | <concat fixlastline="yes" destfile="${build.dir}/${JS_NAME}"> |
50 | | - <path refid="sourcefiles"/> |
| 39 | + <fileset refid="sourcefiles"/> |
51 | 40 | </concat> |
| 41 | + <replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME}" /> |
52 | 42 | </target> |
53 | | - |
54 | | - |
| 43 | + |
| 44 | + |
55 | 45 | <taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" |
56 | | - classpath="${lib.dir}/compiler.jar"/> |
57 | | - |
58 | | - <target name="release"> |
59 | | - |
60 | | - <jscomp compilationLevel="simple" warning="verbose" |
61 | | - debug="false" |
62 | | - output="${build.dir}/tmp.js"> |
| 46 | + classpath="${lib.dir}/compiler.jar" onerror="report"/> |
| 47 | + |
| 48 | + <target name="release" depends="build"> |
| 49 | + <jscomp compilationLevel="simple" warning="verbose" |
| 50 | + debug="false" |
| 51 | + output="${build.dir}/${JS_NAME_MIN}"> |
63 | 52 | <externs dir="${lib.dir}"> |
64 | | - <file name="${jquery-externs}"/> |
| 53 | + <file name="${jquery-externs}"/> |
65 | 54 | </externs> |
66 | | - <sources dir="${build.dir}"> |
67 | | - <file name="${JS_NAME}" /> |
| 55 | + <sources dir="${src.dir}"> |
| 56 | + <!-- need to write them again here since the closure compiler doesn't understand filesets,... --> |
| 57 | + <file name="LICENSE"/> |
| 58 | + <file name="Core.js"/> |
| 59 | + <file name="Generate.js"/> |
| 60 | + <file name="Parse.js"/> |
| 61 | + <file name="Preload.js"/> |
| 62 | + <file name="Queue.js"/> |
| 63 | + <file name="Renderer.js"/> |
68 | 64 | </sources> |
69 | 65 | </jscomp> |
70 | | - |
71 | | - <concat fixlastline="yes" destfile="${build.dir}/${JS_NAME_MIN}"> |
72 | | - <path refid="minified"/> |
73 | | - </concat> |
| 66 | + <replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME_MIN}" /> |
| 67 | + </target> |
74 | 68 |
|
| 69 | + <target name="clean"> |
| 70 | + <delete file="${build.dir}/${JS_NAME}"></delete> |
| 71 | + <delete file="${build.dir}/${JS_NAME_MIN}"></delete> |
| 72 | + <delete file="${build.dir}/${JQUERY_PLUGIN_NAME}"></delete> |
75 | 73 | </target> |
76 | 74 | </project> |
77 | 75 |
|
0 commit comments