|
22 | 22 | <property name="release.filename" value="jquery-ui-${release.version}" /> |
23 | 23 |
|
24 | 24 | <property name="dist.dir" value="dist/${release.filename}/" /> |
| 25 | + <property name="cdndist.dir" value="dist/${release.filename}-googlecdn" /> |
25 | 26 | <property name="build.dir" value="build" /> |
26 | 27 | <property name="ui.dir" value="../" /> |
27 | 28 | <property name="src.dir" value="${ui.dir}/ui/" /> |
28 | 29 | <property name="theme.dir" value="${ui.dir}/themes/base/" /> |
29 | 30 | <property name="docs.dir" value="${ui.dir}/docs/" /> |
30 | 31 |
|
31 | | - <property name="min.folder" value="${dist.dir}/ui/minified" /> |
| 32 | + <property name="min.dir" value="${dist.dir}/ui/minified" /> |
32 | 33 |
|
33 | 34 | <property name="concatenated" value="jquery-ui" /> |
34 | 35 | <property name="concatenated.i18n" value="jquery-ui-i18n" /> |
35 | 36 |
|
36 | 37 | <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" /> |
| 38 | + <property name="core.files.min" value="jquery.ui.core.min.js, jquery.ui.widget.min.js, jquery.ui.mouse.min.js, jquery.ui.draggable.min.js, jquery.ui.droppable.min.js, jquery.ui.resizable.min.js, jquery.ui.selectable.min.js, jquery.ui.sortable.min.js, jquery.effects.core.min.js" /> |
37 | 39 |
|
38 | 40 | <property description="Google Closure" name="closure-jar" value="${build.dir}/google-compiler-20091218.jar" /> |
39 | 41 |
|
40 | | - <target name="deploy-release" depends="docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder"> |
| 42 | + <target name="deploy-release" depends="clean, docs-download, concatenate, minify, copy, replace-version, prepend-header, zip, googlecdn" description="Release builder"> |
41 | 43 | </target> |
42 | | - |
| 44 | + |
43 | 45 | <target name="replace-version"> |
44 | 46 | <replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true"> |
45 | 47 | <fileset dir="${dist.dir}/ui/" includes="*.js"/> |
|
49 | 51 | </target> |
50 | 52 |
|
51 | 53 | <target name="prepend-header"> |
52 | | - <!-- TODO: refactor this ugly mess --> |
53 | 54 | <copy todir="${dist.dir}/headers/"> |
54 | 55 | <fileset dir="${dist.dir}/ui/" includes="*.js" /> |
55 | 56 | </copy> |
56 | 57 | <replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s"> |
57 | 58 | <fileset dir="${dist.dir}/headers/" includes="*.js"/> |
58 | 59 | </replaceregexp> |
59 | 60 | <for param="file"> |
60 | | - <path><fileset dir="${dist.dir}/ui/minified/" includes="*.js" /></path> |
| 61 | + <path><fileset dir="${min.dir}/" includes="*.js" /></path> |
61 | 62 | <sequential> |
62 | 63 | <propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/> |
63 | 64 | <concat destfile="${dist.dir}/ui-headered/${target}.min.js"> |
|
66 | 67 | </concat> |
67 | 68 | </sequential> |
68 | 69 | </for> |
69 | | - <copy todir="${dist.dir}/ui/minified"> |
| 70 | + <copy todir="${min.dir}"> |
70 | 71 | <fileset dir="${dist.dir}/ui-headered/" includes="*.js" /> |
71 | 72 | </copy> |
| 73 | + |
| 74 | + <!-- once more for the i18n files --> |
| 75 | + <!-- need to clean up headers in those files first |
| 76 | + <copy todir="${dist.dir}/headers/i18n/"> |
| 77 | + <fileset dir="${dist.dir}/ui/i18n/" includes="*.js" /> |
| 78 | + </copy> |
| 79 | + <replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s"> |
| 80 | + <fileset dir="${dist.dir}/headers/i18n/" includes="*.js"/> |
| 81 | + </replaceregexp> |
| 82 | + <for param="file"> |
| 83 | + <path><fileset dir="${min.dir}/i18n/" includes="*.js" /></path> |
| 84 | + <sequential> |
| 85 | + <propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/> |
| 86 | + <concat destfile="${dist.dir}/ui-headered/i18n/${target}.min.js"> |
| 87 | + <header file="${dist.dir}/headers/i18n/${target}.js" /> |
| 88 | + <fileset file="@{file}" /> |
| 89 | + </concat> |
| 90 | + </sequential> |
| 91 | + </for> |
| 92 | + <copy todir="${min.dir}/i18n/"> |
| 93 | + <fileset dir="${dist.dir}/ui-headered/i18n/" includes="*.js" /> |
| 94 | + </copy> |
| 95 | + --> |
| 96 | + |
72 | 97 | <delete dir="${dist.dir}/headers/" /> |
73 | 98 | <delete dir="${dist.dir}/ui-headered/" /> |
74 | 99 | </target> |
|
108 | 133 |
|
109 | 134 | <target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip"> |
110 | 135 | <echo message="Building minified" /> |
111 | | - <delete dir="${min.folder}/" /> |
112 | | - <mkdir dir="${min.folder}" /> |
113 | | - <delete dir="${min.folder}/i18n/" /> |
114 | | - <mkdir dir="${min.folder}/i18n/" /> |
| 136 | + <delete dir="${min.dir}/" /> |
| 137 | + <mkdir dir="${min.dir}" /> |
| 138 | + <delete dir="${min.dir}/i18n/" /> |
| 139 | + <mkdir dir="${min.dir}/i18n/" /> |
115 | 140 |
|
116 | 141 | <apply executable="java" parallel="false"> |
117 | 142 | <fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" /> |
118 | 143 | <arg line="-jar" /> |
119 | | - <arg path="build/google-compiler-20091218.jar" /> |
| 144 | + <arg path="${closure-jar}" /> |
120 | 145 | <arg value="--warning_level" /> |
121 | 146 | <arg value="QUIET" /> |
122 | 147 | <arg value="--js_output_file" /> |
123 | 148 | <targetfile /> |
124 | 149 | <arg value="--js" /> |
125 | | - <mapper type="glob" from="*.js" to="${min.folder}/*.min.js" /> |
| 150 | + <mapper type="glob" from="*.js" to="${min.dir}/*.min.js" /> |
126 | 151 | </apply> |
| 152 | + |
| 153 | + <concat destfile="${min.dir}/${concatenated}.min.js"> |
| 154 | + <filelist dir="${min.dir}" files="${core.files.min}" /> |
| 155 | + <fileset dir="${min.dir}" includes="jquery.ui.*.js, jquery.effects.*.js" excludes="${core.files.min}" /> |
| 156 | + </concat> |
127 | 157 |
|
128 | | - <apply executable="java" parallel="false" verbose="true" dest="${dist.dir}"> |
129 | | - <filelist dir="${dist.dir}/ui/" files="${concatenated}.js" /> |
| 158 | + <apply executable="java" parallel="false"> |
| 159 | + <fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" /> |
130 | 160 | <arg line="-jar" /> |
131 | | - <arg path="build/google-compiler-20091218.jar" /> |
| 161 | + <arg path="${closure-jar}" /> |
132 | 162 | <arg value="--warning_level" /> |
133 | 163 | <arg value="QUIET" /> |
134 | 164 | <arg value="--js_output_file" /> |
135 | 165 | <targetfile /> |
136 | 166 | <arg value="--js" /> |
137 | | - <mapper type="glob" from="${concatenated}.js" to="tmpmin" /> |
| 167 | + <mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" /> |
138 | 168 | </apply> |
139 | | - <concat destfile="${min.folder}/jquery-ui.min.js"> |
140 | | - <filelist files="${src.dir}/jquery.ui.core.js, ${dist.dir}/tmpmin"/> |
141 | | - <filterchain> |
142 | | - <headfilter lines="9"/> |
143 | | - </filterchain> |
144 | | - </concat> |
145 | | - <concat destfile="${min.folder}/jquery-ui.min.js" append="yes"> |
146 | | - <filelist files="${dist.dir}/tmpmin"/> |
| 169 | + |
| 170 | + <concat destfile="${min.dir}/i18n/${concatenated.i18n}.min.js"> |
| 171 | + <fileset dir="${min.dir}/i18n" includes="jquery.ui.*.js" /> |
147 | 172 | </concat> |
148 | | - <delete file="${dist.dir}/tmpmin"/> |
149 | | - |
| 173 | + |
150 | 174 | <echo message="Minified ui/ built." /> |
151 | 175 | </target> |
152 | 176 |
|
|
257 | 281 | </replaceregexp> |
258 | 282 | <echo message="All trailing spaces removed." /> |
259 | 283 | </target> |
| 284 | + |
| 285 | + <target name="googlecdn"> |
| 286 | + <delete dir="${cdndist.dir}" /> |
| 287 | + <mkdir dir="${cdndist.dir}" /> |
| 288 | + <copy todir="${cdndist.dir}"> |
| 289 | + <fileset dir=".." includes="AUTHORS.txt, GPL-LICENSE.txt, MIT-LICENSE.txt, version.txt" /> |
| 290 | + </copy> |
| 291 | + <copy todir="${cdndist.dir}"> |
| 292 | + <fileset dir="${dist.dir}ui" includes="jquery-ui.js" /> |
| 293 | + <fileset dir="${dist.dir}ui/minified" includes="jquery-ui.min.js" /> |
| 294 | + </copy> |
| 295 | + <copy todir="${cdndist.dir}/i18n"> |
| 296 | + <fileset dir="${dist.dir}ui/i18n" /> |
| 297 | + <fileset dir="${dist.dir}ui/minified/i18n" /> |
| 298 | + </copy> |
| 299 | + <copy todir="${cdndist.dir}/themes"> |
| 300 | + <fileset dir="${dist.dir}themes" /> |
| 301 | + </copy> |
| 302 | + <checksum> |
| 303 | + <fileset dir="${cdndist.dir}" /> |
| 304 | + </checksum> |
| 305 | + <for param="file"> |
| 306 | + <path><fileset dir="${cdndist.dir}" includes="**/" excludes="**/*.MD5" /></path> |
| 307 | + <sequential> |
| 308 | + <!-- @{file} is an absolute path, use that ugly regexes to make it relative --> |
| 309 | + <propertyregex override="yes" property="relativepath" input="@{file}" regexp=".+?googlecdn[\\/](.+)$" replace="\1"/> |
| 310 | + <propertyregex override="yes" property="relativepath" input="${relativepath}" regexp="\\" replace="/" global="true" /> |
| 311 | + <concat destfile="${cdndist.dir}/MANIFEST" append="yes">${relativepath} </concat> |
| 312 | + <concat destfile="${cdndist.dir}/MANIFEST" append="yes"><file file="@{file}.MD5" /></concat> |
| 313 | + </sequential> |
| 314 | + </for> |
| 315 | + <delete dir="${cdndist.dir}" includes="**/*.MD5" /> |
| 316 | + <zip destfile="${dist.dir}/../${release.filename}-googlecdn.zip"> |
| 317 | + <zipfileset dir="${cdndist.dir}/" /> |
| 318 | + </zip> |
| 319 | + </target> |
260 | 320 |
|
261 | 321 | </project> |
0 commit comments