-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
76 lines (67 loc) · 2.54 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<project name="smart_helper" default="all" basedir=".">
<loadfile property="version" srcfile="version.txt" />
<property name="prefix" value="." />
<property name="dist" value="${prefix}/dist" description="Folder for release" />
<property name="tools" value="${prefix}/tools" />
<property name="out_name" value="${ant.project.name}" />
<property name="out_file" value="${dist}/${out_name}.js" />
<property name="out_debug_name" value="${ant.project.name}_debug" />
<property name="out_debug_file" value="${dist}/${out_debug_name}.js" />
<target name="all" depends="clean,build,lint,min" />
<target name="init">
<tstamp>
<format property="date" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
</target>
<target name="build" depends="init"
description="Main build, concatenates source files">
<echo message="Building ${out_debug_file}" />
<mkdir dir="${dist}" />
<concat destfile="${out_debug_file}">
<fileset file="src/_intro.js" />
<fileset file="src/core.js" />
<fileset file="src/exports.js" />
<fileset file="src/_outro.js" />
</concat>
<replaceregexp match="@VERSION" replace="${version}"
flags="g" byline="true" file="${out_debug_file}" />
<replaceregexp match="@DATE" replace="${date}" file="${out_debug_file}" />
<echo message="${out_debug_file} built." />
</target>
<target name="lint" depends="build" description="Check source against JSLint">
<exec executable="java">
<arg line="-jar ${tools}/lib/js.jar ${tools}/jslint-check.js" />
</exec>
</target>
<target name="min" depends="build" description="Remove all comments and whitespace">
<echo message="Building ${out_file}" />
<apply executable="java" parallel="false" verbose="true" dest="${dist}">
<fileset dir="${dist}">
<include name="${out_debug_name}.js" />
</fileset>
<arg line="-jar" />
<arg path="${tools}/lib/google-compiler-20100917.jar" />
<arg value="--warning_level" />
<arg value="QUIET" />
<arg value="--js_output_file" />
<targetfile />
<arg value="--js" />
<mapper type="glob" from="${out_debug_name}.js" to="tmpmin" />
</apply>
<concat destfile="${out_file}">
<filelist files="${out_debug_file}, ${dist}/tmpmin" />
<filterchain>
<headfilter lines="6" />
</filterchain>
</concat>
<concat destfile="${out_file}" append="yes">
<filelist files="${dist}/tmpmin" />
</concat>
<replaceregexp match="@DEBUG" replace="" file="${out_file}" />
<delete file="${dist}/tmpmin" />
<echo message="${out_file} built." />
</target>
<target name="clean">
<delete dir="${dist}" />
</target>
</project>