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

This commit is contained in:
jzaefferer 2010-03-29 18:58:38 +02:00
parent ec709ecf87
commit 9fa157840f

View File

@ -28,16 +28,17 @@
<property name="theme.dir" value="${ui.dir}/themes/base/" /> <property name="theme.dir" value="${ui.dir}/themes/base/" />
<property name="docs.dir" value="${ui.dir}/docs/" /> <property name="docs.dir" value="${ui.dir}/docs/" />
<property name="min.folder" value="${dist.dir}/ui/minified" /> <property name="min.dir" value="${dist.dir}/ui/minified" />
<property name="concatenated" value="jquery-ui" /> <property name="concatenated" value="jquery-ui" />
<property name="concatenated.i18n" value="jquery-ui-i18n" /> <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 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 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" />
<property description="Google Closure" name="closure-jar" value="${build.dir}/google-compiler-20091218.jar" /> <property description="Google Closure" name="closure-jar" value="${build.dir}/google-compiler-20091218.jar" />
<target name="deploy-release" depends="docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder"> <target name="deploy-release" depends="clean, docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
</target> </target>
<target name="replace-version"> <target name="replace-version">
@ -49,7 +50,6 @@
</target> </target>
<target name="prepend-header"> <target name="prepend-header">
<!-- TODO: refactor this ugly mess -->
<copy todir="${dist.dir}/headers/"> <copy todir="${dist.dir}/headers/">
<fileset dir="${dist.dir}/ui/" includes="*.js" /> <fileset dir="${dist.dir}/ui/" includes="*.js" />
</copy> </copy>
@ -57,7 +57,7 @@
<fileset dir="${dist.dir}/headers/" includes="*.js"/> <fileset dir="${dist.dir}/headers/" includes="*.js"/>
</replaceregexp> </replaceregexp>
<for param="file"> <for param="file">
<path><fileset dir="${dist.dir}/ui/minified/" includes="*.js" /></path> <path><fileset dir="${min.dir}/" includes="*.js" /></path>
<sequential> <sequential>
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/> <propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
<concat destfile="${dist.dir}/ui-headered/${target}.min.js"> <concat destfile="${dist.dir}/ui-headered/${target}.min.js">
@ -66,9 +66,33 @@
</concat> </concat>
</sequential> </sequential>
</for> </for>
<copy todir="${dist.dir}/ui/minified"> <copy todir="${min.dir}">
<fileset dir="${dist.dir}/ui-headered/" includes="*.js" /> <fileset dir="${dist.dir}/ui-headered/" includes="*.js" />
</copy> </copy>
<!-- once more for the i18n files -->
<!-- need to clean up headers in those files first
<copy todir="${dist.dir}/headers/i18n/">
<fileset dir="${dist.dir}/ui/i18n/" includes="*.js" />
</copy>
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
<fileset dir="${dist.dir}/headers/i18n/" includes="*.js"/>
</replaceregexp>
<for param="file">
<path><fileset dir="${min.dir}/i18n/" includes="*.js" /></path>
<sequential>
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
<concat destfile="${dist.dir}/ui-headered/i18n/${target}.min.js">
<header file="${dist.dir}/headers/i18n/${target}.js" />
<fileset file="@{file}" />
</concat>
</sequential>
</for>
<copy todir="${min.dir}/i18n/">
<fileset dir="${dist.dir}/ui-headered/i18n/" includes="*.js" />
</copy>
-->
<delete dir="${dist.dir}/headers/" /> <delete dir="${dist.dir}/headers/" />
<delete dir="${dist.dir}/ui-headered/" /> <delete dir="${dist.dir}/ui-headered/" />
</target> </target>
@ -108,10 +132,10 @@
<target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip"> <target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
<echo message="Building minified" /> <echo message="Building minified" />
<delete dir="${min.folder}/" /> <delete dir="${min.dir}/" />
<mkdir dir="${min.folder}" /> <mkdir dir="${min.dir}" />
<delete dir="${min.folder}/i18n/" /> <delete dir="${min.dir}/i18n/" />
<mkdir dir="${min.folder}/i18n/" /> <mkdir dir="${min.dir}/i18n/" />
<apply executable="java" parallel="false"> <apply executable="java" parallel="false">
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" /> <fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" />
@ -122,11 +146,16 @@
<arg value="--js_output_file" /> <arg value="--js_output_file" />
<targetfile /> <targetfile />
<arg value="--js" /> <arg value="--js" />
<mapper type="glob" from="*.js" to="${min.folder}/*.min.js" /> <mapper type="glob" from="*.js" to="${min.dir}/*.min.js" />
</apply> </apply>
<apply executable="java" parallel="false" verbose="true" dest="${dist.dir}"> <concat destfile="${min.dir}/${concatenated}.min.js">
<filelist dir="${dist.dir}/ui/" files="${concatenated}.js" /> <filelist dir="${min.dir}" files="${core.files.min}" />
<fileset dir="${min.dir}" includes="jquery.ui.*.js, jquery.effects.*.js" excludes="${core.files.min}" />
</concat>
<apply executable="java" parallel="false">
<fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" />
<arg line="-jar" /> <arg line="-jar" />
<arg path="${closure-jar}" /> <arg path="${closure-jar}" />
<arg value="--warning_level" /> <arg value="--warning_level" />
@ -134,18 +163,12 @@
<arg value="--js_output_file" /> <arg value="--js_output_file" />
<targetfile /> <targetfile />
<arg value="--js" /> <arg value="--js" />
<mapper type="glob" from="${concatenated}.js" to="tmpmin" /> <mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" />
</apply> </apply>
<concat destfile="${min.folder}/jquery-ui.min.js">
<filelist files="${src.dir}/jquery.ui.core.js, ${dist.dir}/tmpmin"/> <concat destfile="${min.dir}/i18n/${concatenated.i18n}.min.js">
<filterchain> <fileset dir="${min.dir}/i18n" includes="jquery.ui.*.js" />
<headfilter lines="9"/>
</filterchain>
</concat> </concat>
<concat destfile="${min.folder}/jquery-ui.min.js" append="yes">
<filelist files="${dist.dir}/tmpmin"/>
</concat>
<delete file="${dist.dir}/tmpmin"/>
<echo message="Minified ui/ built." /> <echo message="Minified ui/ built." />
</target> </target>