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
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
jQuery UI Release!
Call task called 'deploy-release' to build a full release.
The release built will be stored on 'dist' dir.
-->
<project name="jquery-ui" default="deploy-release" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="build/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
<property file="ant.properties" />
<loadfile failonerror="no" srcFile="../version.txt" property="release.version" />
<property name="release.filename" value="jquery-ui-${release.version}" />
<property name="dist.dir" value="dist/${release.filename}/" />
<property name="build.dir" value="build" />
<property name="ui.dir" value="../" />
<property name="src.dir" value="${ui.dir}/ui/" />
<property name="theme.dir" value="${ui.dir}/themes/base/" />
<property name="docs.dir" value="${ui.dir}/docs/" />
<property name="min.folder" value="${dist.dir}/ui/minified" />
<property name="concatenated" value="jquery-ui" />
<property name="concatenated.i18n" value="jquery-ui-i18n" />
<property name="core.files" value="jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js" />
<property description="YUI Compressor" name="yui-jar" value="${build.dir}/yuicompressor-2.4.2.jar" />
<target name="deploy-release" depends="docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
</target>
<target name="replace-version">
<replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
<fileset dir="${dist.dir}/ui/" includes="*.js"/>
<fileset dir="${dist.dir}/ui/minified/" includes="*.js"/>
</replaceregexp>
<echo message="Replaced all @VERSION to ${release.version}." />
</target>
<target name="prepend-header">
<!-- TODO: refactor this ugly mess -->
<copy todir="${dist.dir}/headers/">
<fileset dir="${dist.dir}/ui/" includes="*.js" />
</copy>
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
<fileset dir="${dist.dir}/headers/" includes="*.js"/>
</replaceregexp>
<for param="file">
<path><fileset dir="${dist.dir}/ui/minified/" includes="*.js" /></path>
<sequential>
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
<concat destfile="${dist.dir}/ui-headered/${target}.min.js">
<header file="${dist.dir}/headers/${target}.js" />
<fileset file="@{file}" />
</concat>
</sequential>
</for>
<copy todir="${dist.dir}/ui/minified">
<fileset dir="${dist.dir}/ui-headered/" includes="*.js" />
</copy>
<delete dir="${dist.dir}/headers/" />
<delete dir="${dist.dir}/ui-headered/" />
</target>
<target description="Zip the package" name="zip">
<zip destfile="${dist.dir}/../${release.filename}.zip">
<zipfileset dir="dist/" />
</zip>
</target>
<target name="concatenate">
<echo message="Building concatenated" />
<mkdir dir="${dist.dir}/ui/" />
<delete file="${dist.dir}/ui/${concatenated}.js" />
<concat destfile="${dist.dir}/ui/${concatenated}.js">
<filelist dir="${src.dir}/" files="${core.files}" />
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, effects.*.js" excludes="${core.files}" />
</concat>
<echo message="Concatenated built." />
<concat destfile="${dist.dir}/themes/base/${concatenated}.css">
<fileset dir="${theme.dir}/" includes="ui.core.css" />
<fileset dir="${theme.dir}/" includes="ui.*.css" excludes="ui.all.css, ui.core.css, ui.base.css, ui.theme.css" />
<fileset dir="${theme.dir}/" includes="ui.theme.css" />
</concat>
<echo message="Concatenated theme." />
<mkdir dir="${dist.dir}/ui/i18n/" />
<delete file="${dist.dir}/ui/i18n/${concatenated.i18n}.js" />
<concat destfile="${dist.dir}/ui/i18n/${concatenated.i18n}.js" encoding="utf-8">
<fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" />
</concat>
<echo message="Concatenated i18n built." />
</target>
<target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
<echo message="Building minified" />
<delete dir="${min.folder}/" />
<mkdir dir="${min.folder}" />
<delete dir="${min.folder}/i18n/" />
<mkdir dir="${min.folder}/i18n/" />
<apply executable="java" parallel="false">
<filelist dir="${dist.dir}/ui/" files="${concatenated}.js" />
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" />
<arg line="-jar" />
<arg path="${yui-jar}" />
<arg value="--charset" />
<arg value="UTF-8" />
<srcfile />
<arg line="-o" />
<mapper type="glob" from="*.js" to="${min.folder}/*.min.js" />
<targetfile />
</apply>
<echo message="Minified ui/ built." />
<apply executable="java" parallel="false">
<filelist dir="${dist.dir}/ui/i18n/" files="${concatenated.i18n}.js" />
<fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" />
<arg line="-jar" />
<arg path="${yui-jar}" />
<arg value="--charset" />
<arg value="UTF-8" />
<srcfile />
<arg line="-o" />
<mapper type="glob" from="*.js" to="${min.folder}/i18n/*.min.js" />
<targetfile />
</apply>
<echo message="Minified ui/i18n/ built." />
</target>
<target description="Copy needed folders" name="copy">
<echo message="Copying files" />
<mkdir dir="${dist.dir}" />
<copy overwrite="true" todir="${dist.dir}/">
<fileset dir="${ui.dir}/" includes="jquery-*.js" />
</copy>
<copy overwrite="true" todir="${dist.dir}/ui/">
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" />
</copy>
<copy overwrite="true" todir="${dist.dir}/ui/i18n/" >
<fileset dir="${src.dir}/i18n/" />
</copy>
<copy overwrite="true" todir="${dist.dir}/">
<fileset dir="${ui.dir}/" includes="*.txt" />
</copy>
<copy overwrite="true" todir="${dist.dir}/demos/" >
<fileset dir="${ui.dir}/demos/" />
</copy>
<copy overwrite="true" todir="${dist.dir}/external/" >
<fileset dir="${ui.dir}/external/" />
</copy>
<copy overwrite="true" todir="${dist.dir}/tests/" >
<fileset dir="${ui.dir}/tests/" />
</copy>
<copy overwrite="true" todir="${dist.dir}/docs/" >
<fileset dir="${ui.dir}/docs/" />
</copy>
<copy overwrite="true" todir="${dist.dir}/themes/" >
<fileset dir="${ui.dir}/themes/" />
</copy>
<echo message="Files copied." />
</target>
<target name="clean">
<delete dir="dist" />
</target>
<target name="docs-download">
<mkdir dir="${docs.dir}" />
<property name="url" value="http://docs.jquery.com/action/render/UI/API/${release.version}/" />
<get src="${url}Draggable" dest="${docs.dir}draggable.html" />
<get src="${url}Droppable" dest="${docs.dir}droppable.html" />
<get src="${url}Resizable" dest="${docs.dir}resizable.html" />
<get src="${url}Selectable" dest="${docs.dir}selectable.html" />
<get src="${url}Sortable" dest="${docs.dir}sortable.html" />
<get src="${url}Accordion" dest="${docs.dir}accordion.html" />
<get src="${url}Datepicker" dest="${docs.dir}datepicker.html" />
<get src="${url}Dialog" dest="${docs.dir}dialog.html" />
<get src="${url}Progressbar" dest="${docs.dir}progressbar.html" />
<get src="${url}Slider" dest="${docs.dir}slider.html" />
<get src="${url}Tabs" dest="${docs.dir}tabs.html" />
<get src="http://docs.jquery.com/action/render/UI/Utility/Position" dest="${docs.dir}position.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/animate" dest="${docs.dir}animate.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/addClass" dest="${docs.dir}addClass.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/effect" dest="${docs.dir}effect.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/hide" dest="${docs.dir}hide.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/removeClass" dest="${docs.dir}removeClass.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/show" dest="${docs.dir}show.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/switchClass" dest="${docs.dir}switchClass.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/toggle" dest="${docs.dir}toggle.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/toggleClass" dest="${docs.dir}toggleClass.html" />
</target>
<target name="docs-clean">
<delete dir="${docs.dir}" />
</target>
<target name="whitespace">
<replaceregexp match="[\t ]+$" replace="" flags="g" byline="true">
<fileset dir="${src.dir}" includes="*.js"/>
<fileset dir="${src.dir}/i18n/" includes="*.js"/>
</replaceregexp>
<echo message="All trailing spaces removed." />
</target>
</project>
|