-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
259 lines (200 loc) · 7.55 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?xml version="1.0" encoding="UTF-8"?>
<!--
| Exhibit 3.0 build tasks
-->
<project name="jit-extension" basedir=".">
<property name="extension-name" value="jit-extension"/>
<property name="tools" value="tools"/>
<property name="src" value="src"/>
<property name="tests" value="tests"/>
<property name="lib" value="lib"/>
<property name="build" value="build"/>
<property name="docs" value="${build}/docs"/>
<property name="demos" value="${build}/demos"/>
<property name="bundle" value="${build}/bundle"/>
<property name="bundleStyle" value="${bundle}/styles"/>
<property name="compress" value="${build}/compress"/>
<property name="node" value="${build}/node"/>
<property name="demosSrc" value="demos"/>
<property name="testsOutput" value="${build}/tests"/>
<property name="instrument" value="${build}/instrument"/>
<property name="coverage" value="${build}/coverage"/>
<property name="dist" value="dist"/>
<property name="modules" value=""/>
<property name="lintfile" value=""/>
<property name="extension" value=""/>
<property name="jscoverage.dir" value="/usr/local/bin"/>
<property name="jscoverage.port" value="9876"/>
<property file="local.build.properties"/>
<condition property="jscoverage.exists">
<and>
<resourceexists>
<file file="${jscoverage.dir}/jscoverage-server"/>
</resourceexists>
<resourceexists>
<file file="${jscoverage.dir}/jscoverage"/>
</resourceexists>
</and>
</condition>
<condition property="jscoverage.report.exists">
<resourceexists>
<file file="${lib}/jscoverage-report.js"/>
</resourceexists>
</condition>
<taskdef
name="yui-compressor"
classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask"
classpath="${tools}/yuicompressor-ant/yui-compressor-ant-task.jar;${tools}/yuicompressor/yuicompressor.jar"
/>
<taskdef
name="jsdoctoolkit"
classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"
classpath="${tools}/jsdoc-toolkit-ant/jsdoc-toolkit-ant-task.jar;${tools}/rhino/js.jar"
/>
<taskdef
name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="${tools}/jslint4java/jslint4java.jar"
/>
<!-- Code concatenation in prep for compression -->
<target name="bundle" description="Combine source files in the right order">
<mkdir dir="${bundle}"/>
<mkdir dir="${bundleStyle}"/>
<concat destfile="${bundle}/${extension-name}-bundle.js" force="no">
<fileset dir="${src}/lib" />
<fileset dir="${src}/scripts" />
</concat>
<concat destfile="${bundleStyle}/${extension-name}-bundle.css" force="no">
<fileset dir="${src}/styles/">
<include name="**/*.css"/>
</fileset>
</concat>
</target>
<!-- Code compressor -->
<target name="compress" depends="bundle" description="Compress source files">
<mkdir dir="${compress}"/>
<yui-compressor
munge="false"
warn="false"
jssuffix=".js"
fromdir="${bundle}/"
todir="${compress}/">
<include name="**/*.js"/>
</yui-compressor>
<yui-compressor
munge="true"
warn="false"
csssuffix=".css"
fromdir="${bundle}/"
todir="${compress}/">
<include name="**/*.css"/>
</yui-compressor>
</target>
<!-- Distribution builder -->
<target name="dist" description="Assemble existing and generated files into a directory that can be served online" depends="bundle,compress">
<mkdir dir="${dist}"/>
<copy todir="${dist}">
<fileset dir="${src}"/>
</copy>
<copy todir="${dist}">
<fileset dir="${compress}"/>
</copy>
</target>
<!-- Documentation generator -->
<target name="docs" description="Generate code documentation">
<mkdir dir="${docs}"/>
<jsdoctoolkit
jsdochome="${tools}/jsdoc-toolkit/"
template="jsdoc"
outputdir="${docs}/">
<fileset dir="${src}/" includes="*.js,**/*.js" excludes="lib/*.js,node/*.js" />
</jsdoctoolkit>
</target>
<!-- Coverage reporting -->
<target name="coverage" description="Generate code coverage report">
<fail unless="${jscoverage.exists}"
message="The JSCoverage server and instrumentation programs could not be located, check the jscoverage.dir setting"/>
<fail unless="${jscoverage.report.exists}"
message="The JSCoverage report script could not be located at lib/jscoverage-report.js"/>
<mkdir dir="${instrument}"/>
<mkdir dir="${coverage}"/>
<exec dir="." executable="${jscoverage.dir}/jscoverage-server" spawn="true">
<arg line="--port=${jscoverage.port} --report-dir=${coverage} --no-instrument=${instrument}/lib/ --no-instrument=${instrument}/tests/ --no-instrument=${instrument}/src/"/>
</exec>
<exec dir="." executable="${jscoverage.dir}/jscoverage">
<arg line="--no-instrument=lib/ ${src} ${instrument}/src"/>
</exec>
<copy todir="${instrument}/tests">
<fileset dir="${tests}"/>
</copy>
<copy todir="${instrument}/lib">
<fileset dir="${lib}"/>
</copy>
<java
classpath="${tools}/rhino/js.jar"
classname="org.mozilla.javascript.tools.shell.Main">
<arg line="-opt -1 ${lib}/coverage-runner.js ${jscoverage.port}"/>
</java>
<exec dir="." executable="${jscoverage.dir}/jscoverage-server">
<arg line="--port=${jscoverage.port} --shutdown"/>
</exec>
</target>
<!-- Mono lint -->
<target name="lintone" description="Run lint on one file">
<!-- see http://happygiraffe.github.com/jslint4java/ant.html -->
<jslint haltOnFailure="false" options="evil,sloppy,white,plusplus,browser,nomen,devel">
<predef>jQuery, $$</predef>
<formatter type="plain" />
<fileset dir="." includes="${lintfile}" />
</jslint>
</target>
<!-- Tests -->
<target name="lint">
<!-- see http://happygiraffe.github.com/jslint4java/ant.html -->
<jslint haltOnFailure="false" options="evil,sloppy,white,plusplus,browser,nomen,devel">
<predef>jQuery, $$, Exhibit</predef>
<formatter type="plain" />
<fileset dir="${src}" includes="*.js,**/*.js" excludes="lib/*.js,exhibit-api.js" />
</jslint>
</target>
<target name="qunit">
<mkdir dir="${testsOutput}"/>
<!-- the magic starts in lib/test-runner.js -->
<java
classpath="${tools}/rhino/js.jar"
classname="org.mozilla.javascript.tools.shell.Main">
<arg line="-opt -1 ${lib}/test-runner.js ${modules}"/>
</java>
</target>
<target name="test" depends="lint,qunit" description="Run all tests"/>
<!-- Cleanup -->
<target name="clean-demos">
<delete dir="${demos}/" quiet="true"/>
</target>
<target name="clean-docs">
<delete dir="${docs}/" quiet="true"/>
</target>
<target name="clean-node">
<delete dir="${node}" quiet="true"/>
</target>
<target name="clean-bundle">
<delete dir="${bundle}" quiet="true"/>
</target>
<target name="clean-compress">
<delete dir="${compress}/" quiet="true"/>
</target>
<target name="clean-dist">
<delete dir="${dist}" quiet="true"/>
</target>
<target name="clean-coverage">
<delete dir="${coverage}/" quiet="true"/>
</target>
<target name="clean-instrument">
<delete dir="${instrument}/" quiet="true"/>
</target>
<target name="clean-jscoverage" depends="clean-coverage,clean-instrument"/>
<target name="clean-tests">
<delete dir="${testsOutput}/" quiet="true"/>
</target>
<target name="clean" depends="clean-demos,clean-node,clean-bundle,clean-compress,clean-dist,clean-docs,clean-jscoverage,clean-tests" description="Remove build artificats"/>
</project>