/
build-tasks.xml
297 lines (266 loc) · 11.3 KB
/
build-tasks.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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-tasks" default="default" basedir=".">
<dirname property="tasks.basedir" file="${ant.file.build-tasks}"/>
<property file="${tasks.basedir}/build-tasks.properties"/>
<!-- Version and build time-->
<property name="wet-boew-build.version" value="v3.0.2-a1"/>
<tstamp>
<format property="wet-boew-build.starttime" pattern="yyyy-MM-dd hh:mm aa" locale="en,CA"/>
</tstamp>
<!-- ant contribs task definition -->
<path id="antcontrib.classpath">
<pathelement location="${antcontribs.jar}" />
</path>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath refid="antcontrib.classpath" />
</taskdef>
<extension-point name="-init"/>
<!-- yui-compressor task definition -->
<path id="yui.classpath">
<pathelement location="${yui-compressor.jar}" />
<pathelement location="${yui-compressor-ant-task.jar}" />
</path>
<taskdef name="yui-compressor" classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask">
<classpath refid="yui.classpath" />
</taskdef>
<!-- css embed Base64Encode images task definition -->
<path id="cssurlembed.classpath">
<pathelement location="${cssurlembed.jar}" />
</path>
<taskdef name="cssurlembed" classname="net.nczonline.web.cssembed.CSSEmbedTask">
<classpath refid="cssurlembed.classpath" />
</taskdef>
<!-- JSHint Ant task definition -->
<path id="jshint.classpath">
<pathelement location="${jshint.jar}" />
</path>
<taskdef name="jshint" classname="com.philmander.jshint.JsHintAntTask">
<classpath refid="jshint.classpath" />
</taskdef>
<!-- Include jruby + gems (compass + sass) -->
<target name="-build-jruby" extensionOf="-init" depends="-jruby.jar.check" unless="jruby.jar.exists">
<mkdir dir="${lib.dir}/jruby-compiled" />
<parallel>
<get src="http://jruby.org.s3.amazonaws.com/downloads/${jruby.version}/${jruby.jar}" dest="${lib.dir}/${jruby.jar}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${sass.gem}" dest="${gem.dir}/${sass.gem}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${chunky_png.gem}" dest="${gem.dir}/${chunky_png.gem}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${fssm.gem}" dest="${gem.dir}/${fssm.gem}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${compass.gem}" dest="${gem.dir}/${compass.gem}" skipexisting="true"/>
</parallel>
<parallel>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${sass.gem}" --local -f"/>
</java>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${chunky_png.gem}" --local -f"/>
</java>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${fssm.gem}" --local -f"/>
</java>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${compass.gem}" --local -f"/>
</java>
</parallel>
</target>
<target name="-jruby.jar.check">
<checksum file="${tasks.basedir}/build-tasks.properties" property="jruby.depends"/>
<condition property="jruby.jar.exists">
<and>
<available file="${lib.dir}/${jruby.jar}" type="file"/>
<available file="${lib.dir}/vendors-${jruby.depends}" type="dir"/>
</and>
</condition>
</target>
<!-- Compile all of the SCSS files into their CSS counterparts "ant compile.sass" -->
<target name="compile.sass">
<antcall target="call.sass">
<param name="command" value="compile"/>
</antcall>
<echo level="info" message="---Converted CSS SCSS Files into CSS---"/>
</target>
<target name="call.sass">
<java fork="true" failonerror="true" jar="${lib.dir}/${jruby.jar}">
<arg path="${tasks.basedir}/compile.rb"/>
<arg path="${lib.dir}/vendors-${jruby.depends}/gems/"/>
<arg value="${command}"/>
<arg path="${src.dir}"/>
<arg value="${build.dir}/_css"/>
</java>
</target>
<!-- Watch for any polling changes in the SCSS directory "ant watch.sass" -->
<target name="watch.sass">
<antcall target="call.sass">
<param name="command" value="watch"/>
</antcall>
<echo level="info" message="---Watching for SCSS Changes in CSS Directory---"/>
</target>
<target name="-jshint">
<jshint dir="${src.dir}" fail="${jshint.failbuild}" globalsFile="${jshint.globals.file}" options="strict:false">
<report type="xml" destfile="${build.dir}/jshint.out.xml" />
<include name="**/*.js"/>
<exclude name="**/*.min.js"/>
<exclude name="jquerymobile/jquery.mobile.js"/>
<exclude name="polyfills/datalist.js"/>
<exclude name="polyfills/detailssummary.js"/>
<exclude name="polyfills/html5shiv.js"/>
<exclude name="polyfills/localstorage.js"/>
<exclude name="polyfills/slider.js"/>
<exclude name="dependencies/bookmark.js"/>
<exclude name="dependencies/browsertweaks.js"/>
<exclude name="dependencies/colorbox.js"/>
<exclude name="dependencies/easytabs.js"/>
<exclude name="dependencies/hashchange.js"/>
<exclude name="dependencies/hoverintent.js"/>
<exclude name="dependencies/json.js"/>
<exclude name="dependencies/matchMedia.js"/>
<exclude name="dependencies/metadata.js"/>
<exclude name="dependencies/outside.js"/>
<exclude name="dependencies/pie.js"/>
<exclude name="dependencies/prettify.js"/>
<exclude name="dependencies/prettify/**/*.js"/>
<exclude name="dependencies/raphael.js"/>
<exclude name="dependencies/resize.js"/>
<exclude name="dependencies/validate.js"/>
<exclude name="dependencies/validateAdditional.js"/>
<exclude name="dependencies/xregexp.js"/>
</jshint>
</target>
<target name="csslint" description="Runs CSSLint on CSS produced by the project's Sass files and outputs results to the console" depends="prepare-files">
<apply executable="java" failonerror="false" parallel="false">
<fileset dir="${src.dir}/css">
<include name="*.css"/>
<exclude name="jquery.mobile.structure.css"/>
<exclude name="*.min.css"/>
</fileset>
<arg value="-jar"/>
<arg path="${lib.dir}/js.jar"/>
<arg path="${lib.dir}/csslint-rhino.js" />
<!-- your customized arguments go here -->
<arg value="--format=compact"/>
<arg value="--ignore=ids,important,qualified-headings,universal-selector,unqualified-attributes,star-property-hack,unique-headings,adjoining-classes,float,overqualified-elements,font-sizes,regex-selectors"/>
<arg value="--error=outline-none"/>
<srcfile/>
</apply>
</target>
<target name="csslint-report" description="Produceds CSSLint XML report in the build directory for selected project" depends="prepare-files">
<apply executable="java" failonerror="false" parallel="true" output="${build.dir}/csslint.out.xml">
<fileset dir="${src.dir}/css">
<include name="*.css"/>
</fileset>
<arg value="-jar"/>
<arg path="${lib.dir}/js.jar"/>
<arg path="${lib.dir}/csslint-rhino.js" />
<!-- your customized arguments go here -->
<arg value="--format=lint-xml"/>
<arg value="--ignore=ids,important,qualified-headings,universal-selector,unqualified-attributes,star-property-hack,unique-headings,adjoining-classes,float,overqualified-elements,font-sizes,regex-selectors"/>
<arg value="--error=outline-none"/>
<srcfile/>
</apply>
</target>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<extension-point name="build" depends="prepare-files, encode-images, compress" description="Core build task. Subprojects should subscrib to the 'prepare-files' and 'compress'" />
<extension-point name="prepare-files" depends="-init" />
<extension-point name="encode-images" depends="prepare-files" />
<target name="encode-css" extensionOf="encode-images" depends="-base64-encode"/>
<extension-point name="compress" depends="encode-images, -minify" />
<extension-point name="test" />
<target name="lint" extensionOf="test" depends="-jshint, csslint"/>
<target name="-base64-encode">
<property name="image.dir" location="${build.dir}/images"/>
<cssurlembed skipMissing="true" root="${image.dir}">
<fileset dir="${build.dir}/css">
<include name="*.css"/>
<exclude name="*ie.css"/>
<!-- Because of themometer images -->
<exclude name="util.css"/>
</fileset>
</cssurlembed>
</target>
<target name="-base64-encode-jquery">
<property name="jquerymobile.dir" location="${src.dir}/jquerymobile"/>
<cssurlembed skipMissing="false" root="${jquerymobile.dir}">
<fileset dir="${build.dir}/css">
<include name="jquery.mobile.css"/>
</fileset>
</cssurlembed>
</target>
<target name="-minify">
<yui-compressor warn="false" munge="true" preserveAllSemiColons="false" fromDir="${build.dir}" toDir="${build.dir}" charset="utf-8">
<include name="**/*.css" />
<include name="**/*.js" />
<exclude name="**/*-min.css" />
<exclude name="**/settings.js" />
<exclude name="**/*-min.js" />
<exclude name="**/*.min.js" />
</yui-compressor>
<delete>
<fileset dir="${build.dir}">
<include name="**/*.css" />
<include name="**/*.js" />
<exclude name="**/settings.js" />
<exclude name="**/*-min.css" />
<exclude name="**/*-min.js" />
<exclude name="**/*.min.js" />
</fileset>
</delete>
</target>
<target name="-copy-css" depends="compile.sass">
<loadfile srcfile="${build.dir}/../build-css-head.txt" property="build.css.head"/>
<move todir="${build.dir}/css">
<fileset dir="${build.dir}/_css">
<include name="*.css"/>
</fileset>
<filterchain>
<concatfilter prepend="${build.dir}/../build-css-head.txt"/>
<replacetokens>
<token key="wet-boew-build.version" value="${wet-boew-build.version}"/>
<token key="wet-boew-build.starttime" value="${wet-boew-build.starttime}"/>
</replacetokens>
</filterchain>
</move>
</target>
<target name="-copy-jquery-css">
<loadfile srcfile="${build.dir}/../build-css-head.txt" property="build.css.head"/>
<loadfile srcfile="${src.dir}/../js/jquerymobile/jquery.mobile.structure.min.css" property="jquery.mobile.license">
<filterchain>
<headfilter lines="1"/>
</filterchain>
</loadfile>
<concat dest="${build.dir}/css/jquery.mobile.css">
<header>${build.css.head}
${jquery.mobile.license}</header>
<fileset dir="${src.dir}/../js/jquerymobile">
<include name="*structure.css"/>
</fileset>
<fileset dir="${src.dir}/jquerymobile">
<include name="*theme.css"/>
</fileset>
<filterchain>
<replacetokens>
<token key="wet-boew-build.version" value="${wet-boew-build.version}"/>
<token key="wet-boew-build.starttime" value="${wet-boew-build.starttime}"/>
</replacetokens>
</filterchain>
</concat>
</target>
<target name="-copy-js">
<copy todir="${build.dir}/js">
<fileset dir="${src.dir}/js"/>
<filterchain>
<concatfilter prepend="${build.dir}/../build-js-head.txt"/>
<replacetokens>
<token key="wet-boew-build.version" value="${wet-boew-build.version}"/>
<token key="wet-boew-build.starttime" value="${wet-boew-build.starttime}"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="-copy-images">
<copy todir="${build.dir}/images">
<fileset dir="${src.dir}/images" />
</copy>
</target>
</project>