forked from asual/jquery-address
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
134 lines (121 loc) · 4.67 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<project name="jQuery Address" default="release" basedir=".">
<property file="build.properties" />
<path id="classpath">
<fileset dir="lib" includes="*.jar" />
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="classpath" />
<target name="release">
<antcall target="dist" />
<antcall target="test" />
<antcall target="samples" />
<antcall target="bundle" />
</target>
<target name="bundle">
<copy todir="${name}-${version}">
<fileset dir="${dist.dir}">
<include name="${name}-${version}.js" />
<include name="${name}-${version}.min.js" />
</fileset>
<fileset dir="${basedir}">
<include name="${samples.dir}/**/*" />
</fileset>
</copy>
<zip destfile="./../${name}-${version}.zip"
basedir="${basedir}"
includes="${name}-${version}/" />
<delete dir="${name}-${version}" />
</target>
<target name="dist">
<delete includeemptydirs="true">
<fileset dir="${dist.dir}" includes="**/*" />
</delete>
<antcall target="validate">
<param name="file" value="${src.dir}/${name}" />
</antcall>
<copy todir="${dist.dir}">
<fileset dir="${src.dir}"/>
</copy>
<antcall target="process">
<param name="file" value="${dist.dir}/${name}" />
</antcall>
<antcall target="compress">
<param name="file" value="${dist.dir}/${name}-${version}.min.js" />
</antcall>
</target>
<target name="validate">
<java classpath="lib/js.jar"
classname="org.mozilla.javascript.tools.shell.Main"
failonerror="true" fork="true">
<arg line="${lib.dir}/rhino.js ${file}.js" />
</java>
</target>
<target name="process">
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd HH:mm:ss Z (EEE, dd MMM yyyy)" />
</tstamp>
<replaceregexp match="\$\{version\}" file="${file}.js">
<substitution expression="${version}"/>
</replaceregexp>
<replaceregexp match="\$\{timestamp\}" file="${file}.js">
<substitution expression="${timestamp}"/>
</replaceregexp>
<copy file="${file}.js" tofile="${file}-${version}.min.js" />
<move file="${file}.js" tofile="${file}-${version}.js" />
</target>
<target name="compress">
<java jar="${lib.dir}/compiler.jar"
failonerror="true" fork="true">
<arg line="--js=${file} --js_output_file=${file}.tmp" />
</java>
<concat destfile="${file}.lic">
<filelist files="${file}" />
<filterchain>
<headfilter lines="10" />
</filterchain>
</concat>
<concat destfile="${file}">
<filelist files="${file}.lic,${file}.tmp" />
</concat>
<delete>
<filelist files="${file}.lic,${file}.tmp" />
</delete>
</target>
<target name="sample">
<delete>
<fileset dir="${dir}" includes="${name}-\d.\d+.min.js" />
</delete>
<copy file="${dist.dir}/${name}-${version}.min.js" todir="${dir}" overwrite="true" />
</target>
<target name="samples">
<antcall target="sample">
<param name="dir" value="${samples.dir}/accordion" />
</antcall>
<antcall target="sample">
<param name="dir" value="${samples.dir}/api" />
</antcall>
<antcall target="sample">
<param name="dir" value="${samples.dir}/crawling" />
</antcall>
<antcall target="sample">
<param name="dir" value="${samples.dir}/events" />
</antcall>
<antcall target="sample">
<param name="dir" value="${samples.dir}/express/public" />
</antcall>
<antcall target="sample">
<param name="dir" value="${samples.dir}/form" />
</antcall>
<antcall target="sample">
<param name="dir" value="${samples.dir}/state" />
</antcall>
<antcall target="sample">
<param name="dir" value="${samples.dir}/tabs" />
</antcall>
</target>
<target name="test">
<delete>
<fileset dir="${test.dir}" includes="${name}-\d.\d+.min.js" />
</delete>
<copy file="${dist.dir}/${name}-${version}.min.js" todir="${test.dir}" overwrite="true" />
</target>
</project>