Skip to content

Commit 9fa1578

Browse files
committed
Build: Minify i18n files and build a concatenated version; also fixing the double-header issue for the jquery-ui.min.js file and removing additional headers for the various components; Fixes #5444 - build incomplete since removing yuimin and adding closure compiler
1 parent ec709ec commit 9fa1578

File tree

1 file changed

+47
-24
lines changed

1 file changed

+47
-24
lines changed

build/build.xml

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@
2828
<property name="theme.dir" value="${ui.dir}/themes/base/" />
2929
<property name="docs.dir" value="${ui.dir}/docs/" />
3030

31-
<property name="min.folder" value="${dist.dir}/ui/minified" />
31+
<property name="min.dir" value="${dist.dir}/ui/minified" />
3232

3333
<property name="concatenated" value="jquery-ui" />
3434
<property name="concatenated.i18n" value="jquery-ui-i18n" />
3535

3636
<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" />
37+
<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" />
3738

3839
<property description="Google Closure" name="closure-jar" value="${build.dir}/google-compiler-20091218.jar" />
3940

40-
<target name="deploy-release" depends="docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
41+
<target name="deploy-release" depends="clean, docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
4142
</target>
42-
43+
4344
<target name="replace-version">
4445
<replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
4546
<fileset dir="${dist.dir}/ui/" includes="*.js"/>
@@ -49,15 +50,14 @@
4950
</target>
5051

5152
<target name="prepend-header">
52-
<!-- TODO: refactor this ugly mess -->
5353
<copy todir="${dist.dir}/headers/">
5454
<fileset dir="${dist.dir}/ui/" includes="*.js" />
5555
</copy>
5656
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
5757
<fileset dir="${dist.dir}/headers/" includes="*.js"/>
5858
</replaceregexp>
5959
<for param="file">
60-
<path><fileset dir="${dist.dir}/ui/minified/" includes="*.js" /></path>
60+
<path><fileset dir="${min.dir}/" includes="*.js" /></path>
6161
<sequential>
6262
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
6363
<concat destfile="${dist.dir}/ui-headered/${target}.min.js">
@@ -66,9 +66,33 @@
6666
</concat>
6767
</sequential>
6868
</for>
69-
<copy todir="${dist.dir}/ui/minified">
69+
<copy todir="${min.dir}">
7070
<fileset dir="${dist.dir}/ui-headered/" includes="*.js" />
7171
</copy>
72+
73+
<!-- once more for the i18n files -->
74+
<!-- need to clean up headers in those files first
75+
<copy todir="${dist.dir}/headers/i18n/">
76+
<fileset dir="${dist.dir}/ui/i18n/" includes="*.js" />
77+
</copy>
78+
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
79+
<fileset dir="${dist.dir}/headers/i18n/" includes="*.js"/>
80+
</replaceregexp>
81+
<for param="file">
82+
<path><fileset dir="${min.dir}/i18n/" includes="*.js" /></path>
83+
<sequential>
84+
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
85+
<concat destfile="${dist.dir}/ui-headered/i18n/${target}.min.js">
86+
<header file="${dist.dir}/headers/i18n/${target}.js" />
87+
<fileset file="@{file}" />
88+
</concat>
89+
</sequential>
90+
</for>
91+
<copy todir="${min.dir}/i18n/">
92+
<fileset dir="${dist.dir}/ui-headered/i18n/" includes="*.js" />
93+
</copy>
94+
-->
95+
7296
<delete dir="${dist.dir}/headers/" />
7397
<delete dir="${dist.dir}/ui-headered/" />
7498
</target>
@@ -108,10 +132,10 @@
108132

109133
<target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
110134
<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/" />
135+
<delete dir="${min.dir}/" />
136+
<mkdir dir="${min.dir}" />
137+
<delete dir="${min.dir}/i18n/" />
138+
<mkdir dir="${min.dir}/i18n/" />
115139

116140
<apply executable="java" parallel="false">
117141
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" />
@@ -122,31 +146,30 @@
122146
<arg value="--js_output_file" />
123147
<targetfile />
124148
<arg value="--js" />
125-
<mapper type="glob" from="*.js" to="${min.folder}/*.min.js" />
149+
<mapper type="glob" from="*.js" to="${min.dir}/*.min.js" />
126150
</apply>
151+
152+
<concat destfile="${min.dir}/${concatenated}.min.js">
153+
<filelist dir="${min.dir}" files="${core.files.min}" />
154+
<fileset dir="${min.dir}" includes="jquery.ui.*.js, jquery.effects.*.js" excludes="${core.files.min}" />
155+
</concat>
127156

128-
<apply executable="java" parallel="false" verbose="true" dest="${dist.dir}">
129-
<filelist dir="${dist.dir}/ui/" files="${concatenated}.js" />
157+
<apply executable="java" parallel="false">
158+
<fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" />
130159
<arg line="-jar" />
131160
<arg path="${closure-jar}" />
132161
<arg value="--warning_level" />
133162
<arg value="QUIET" />
134163
<arg value="--js_output_file" />
135164
<targetfile />
136165
<arg value="--js" />
137-
<mapper type="glob" from="${concatenated}.js" to="tmpmin" />
166+
<mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" />
138167
</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"/>
168+
169+
<concat destfile="${min.dir}/i18n/${concatenated.i18n}.min.js">
170+
<fileset dir="${min.dir}/i18n" includes="jquery.ui.*.js" />
147171
</concat>
148-
<delete file="${dist.dir}/tmpmin"/>
149-
172+
150173
<echo message="Minified ui/ built." />
151174
</target>
152175

0 commit comments

Comments
 (0)