mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Build: ant size
will now give you a report detailing differences in size since the last time you ran the report
This commit is contained in:
parent
bdd602e21b
commit
264139b225
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
build/dist
|
||||
build/size
|
||||
build/build/.sizecache.json
|
||||
docs
|
||||
.project
|
||||
*~
|
||||
|
222
build/build.xml
222
build/build.xml
@ -32,6 +32,7 @@
|
||||
<property name="docs.dir" value="${dist.dir}/docs/" />
|
||||
|
||||
<property name="min.dir" value="${dist.dir}/ui/minified" />
|
||||
<property name="size.dir" value="size" />
|
||||
|
||||
<property name="concatenated" value="jquery-ui" />
|
||||
<property name="concatenated.i18n" value="jquery-ui-i18n" />
|
||||
@ -47,7 +48,7 @@
|
||||
|
||||
<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/" includes="*.js"/>
|
||||
<fileset dir="${dist.dir}/ui/minified/" includes="*.js"/>
|
||||
<fileset dir="${dist.dir}/themes/" includes="**/*.css"/>
|
||||
</replaceregexp>
|
||||
@ -59,7 +60,7 @@
|
||||
<fileset dir="${dist.dir}/ui/" includes="*.js" />
|
||||
</copy>
|
||||
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
|
||||
<fileset dir="${dist.dir}/headers/" includes="*.js"/>
|
||||
<fileset dir="${dist.dir}/headers/" includes="*.js"/>
|
||||
</replaceregexp>
|
||||
<for param="file">
|
||||
<path><fileset dir="${min.dir}/" includes="*.js" /></path>
|
||||
@ -79,7 +80,7 @@
|
||||
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
|
||||
</copy>
|
||||
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
|
||||
<fileset dir="${dist.dir}/headers/" includes="*.css"/>
|
||||
<fileset dir="${dist.dir}/headers/" includes="*.css"/>
|
||||
</replaceregexp>
|
||||
<for param="file">
|
||||
<path><fileset dir="${dist.dir}/themes/base/minified" includes="*.css" /></path>
|
||||
@ -101,7 +102,7 @@
|
||||
<fileset dir="${dist.dir}/ui/i18n/" includes="*.js" />
|
||||
</copy>
|
||||
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
|
||||
<fileset dir="${dist.dir}/headers/i18n/" includes="*.js"/>
|
||||
<fileset dir="${dist.dir}/headers/i18n/" includes="*.js"/>
|
||||
</replaceregexp>
|
||||
<for param="file">
|
||||
<path><fileset dir="${min.dir}/i18n/" includes="*.js" /></path>
|
||||
@ -161,45 +162,45 @@
|
||||
<mkdir dir="${min.dir}/i18n/" />
|
||||
<mkdir dir="${dist.dir}/themes/base/minified" />
|
||||
|
||||
<parallel threadsperprocessor="1">
|
||||
<parallel threadsperprocessor="1">
|
||||
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="${dist.dir}/ui" includes="*.js" />
|
||||
<arg line="-jar" />
|
||||
<arg path="${closure-jar}" />
|
||||
<arg value="--warning_level" />
|
||||
<arg value="QUIET" />
|
||||
<arg value="--js_output_file" />
|
||||
<targetfile />
|
||||
<arg value="--js" />
|
||||
<mapper type="glob" from="*.js" to="${min.dir}/*.min.js" />
|
||||
</apply>
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="${dist.dir}/ui" includes="*.js" />
|
||||
<arg line="-jar" />
|
||||
<arg path="${closure-jar}" />
|
||||
<arg value="--warning_level" />
|
||||
<arg value="QUIET" />
|
||||
<arg value="--js_output_file" />
|
||||
<targetfile />
|
||||
<arg value="--js" />
|
||||
<mapper type="glob" from="*.js" to="${min.dir}/*.min.js" />
|
||||
</apply>
|
||||
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="${dist.dir}/ui/i18n" includes="*.js" />
|
||||
<arg line="-jar" />
|
||||
<arg path="${closure-jar}" />
|
||||
<arg value="--warning_level" />
|
||||
<arg value="QUIET" />
|
||||
<arg value="--js_output_file" />
|
||||
<targetfile />
|
||||
<arg value="--js" />
|
||||
<mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" />
|
||||
</apply>
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="${dist.dir}/ui/i18n" includes="*.js" />
|
||||
<arg line="-jar" />
|
||||
<arg path="${closure-jar}" />
|
||||
<arg value="--warning_level" />
|
||||
<arg value="QUIET" />
|
||||
<arg value="--js_output_file" />
|
||||
<targetfile />
|
||||
<arg value="--js" />
|
||||
<mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" />
|
||||
</apply>
|
||||
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
|
||||
<arg line="-jar" />
|
||||
<arg path="${yuicompressor-jar}" />
|
||||
<arg line="--charset utf-8" />
|
||||
<arg line="-v" />
|
||||
<srcfile />
|
||||
<arg line="-o" />
|
||||
<mapper type="glob" from="*.css" to="${dist.dir}/themes/base/minified/*.min.css" />
|
||||
<targetfile/>
|
||||
</apply>
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
|
||||
<arg line="-jar" />
|
||||
<arg path="${yuicompressor-jar}" />
|
||||
<arg line="--charset utf-8" />
|
||||
<arg line="-v" />
|
||||
<srcfile />
|
||||
<arg line="-o" />
|
||||
<mapper type="glob" from="*.css" to="${dist.dir}/themes/base/minified/*.min.css" />
|
||||
<targetfile/>
|
||||
</apply>
|
||||
|
||||
</parallel>
|
||||
</parallel>
|
||||
|
||||
<replaceregexp match=".css" replace=".min.css" flags="g">
|
||||
<fileset dir="${dist.dir}/themes/base/minified/">
|
||||
@ -255,63 +256,63 @@
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="dist" />
|
||||
</target>
|
||||
<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}/" />
|
||||
|
||||
<parallel threadcount="8">
|
||||
<parallel threadcount="8">
|
||||
|
||||
<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}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}Autocomplete" dest="${docs.dir}autocomplete.html" />
|
||||
<get src="${url}Button" dest="${docs.dir}button.html" />
|
||||
<get src="${url}Datepicker" dest="${docs.dir}datepicker.html" />
|
||||
<get src="${url}Dialog" dest="${docs.dir}dialog.html" />
|
||||
<get src="${url}Menu" dest="${docs.dir}menu.html" />
|
||||
<get src="${url}Progressbar" dest="${docs.dir}progressbar.html" />
|
||||
<get src="${url}Slider" dest="${docs.dir}slider.html" />
|
||||
<get src="${url}Spinner" dest="${docs.dir}spinner.html" />
|
||||
<get src="${url}Tooltip" dest="${docs.dir}tooltip.html" />
|
||||
<get src="${url}Tabs" dest="${docs.dir}tabs.html" />
|
||||
<get src="${url}Accordion" dest="${docs.dir}accordion.html" />
|
||||
<get src="${url}Autocomplete" dest="${docs.dir}autocomplete.html" />
|
||||
<get src="${url}Button" dest="${docs.dir}button.html" />
|
||||
<get src="${url}Datepicker" dest="${docs.dir}datepicker.html" />
|
||||
<get src="${url}Dialog" dest="${docs.dir}dialog.html" />
|
||||
<get src="${url}Menu" dest="${docs.dir}menu.html" />
|
||||
<get src="${url}Progressbar" dest="${docs.dir}progressbar.html" />
|
||||
<get src="${url}Slider" dest="${docs.dir}slider.html" />
|
||||
<get src="${url}Spinner" dest="${docs.dir}spinner.html" />
|
||||
<get src="${url}Tooltip" dest="${docs.dir}tooltip.html" />
|
||||
<get src="${url}Tabs" dest="${docs.dir}tabs.html" />
|
||||
|
||||
<get src="${url}Position" dest="${docs.dir}position.html" />
|
||||
<get src="${url}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" />
|
||||
<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" />
|
||||
|
||||
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Blind" dest="${docs.dir}effect-blind.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Clip" dest="${docs.dir}effect-clip.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Drop" dest="${docs.dir}effect-drop.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Explode" dest="${docs.dir}effect-explode.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Fade" dest="${docs.dir}effect-fade.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Fold" dest="${docs.dir}effect-fold.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Puff" dest="${docs.dir}effect-puff.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Slide" dest="${docs.dir}effect-slide.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Scale" dest="${docs.dir}effect-scale.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Blind" dest="${docs.dir}effect-blind.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Clip" dest="${docs.dir}effect-clip.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Drop" dest="${docs.dir}effect-drop.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Explode" dest="${docs.dir}effect-explode.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Fade" dest="${docs.dir}effect-fade.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Fold" dest="${docs.dir}effect-fold.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Puff" dest="${docs.dir}effect-puff.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Slide" dest="${docs.dir}effect-slide.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Scale" dest="${docs.dir}effect-scale.html" />
|
||||
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Bounce" dest="${docs.dir}effect-bounce.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Highlight" dest="${docs.dir}effect-highlight.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Pulsate" dest="${docs.dir}effect-pulsate.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Shake" dest="${docs.dir}effect-shake.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Size" dest="${docs.dir}effect-size.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Transfer" dest="${docs.dir}effect-transfer.html" />
|
||||
</parallel>
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Bounce" dest="${docs.dir}effect-bounce.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Highlight" dest="${docs.dir}effect-highlight.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Pulsate" dest="${docs.dir}effect-pulsate.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Shake" dest="${docs.dir}effect-shake.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Size" dest="${docs.dir}effect-size.html" />
|
||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Transfer" dest="${docs.dir}effect-transfer.html" />
|
||||
</parallel>
|
||||
</target>
|
||||
|
||||
<target name="themes-download">
|
||||
@ -325,11 +326,11 @@
|
||||
<sequential>
|
||||
<get src="http://ui-dev.jquery.com/download/?@{url}" dest="${zip}" />
|
||||
<unzip src="${zip}"
|
||||
dest="${dist.dir}themes/">
|
||||
<patternset>
|
||||
<include name="development-bundle/themes/**"/>
|
||||
<exclude name="development-bundle/themes/base/**"/>
|
||||
</patternset>
|
||||
dest="${dist.dir}themes/">
|
||||
<patternset>
|
||||
<include name="development-bundle/themes/**"/>
|
||||
<exclude name="development-bundle/themes/base/**"/>
|
||||
</patternset>
|
||||
<mapper type="glob" from="development-bundle/themes/*" to="*" />
|
||||
</unzip>
|
||||
<delete file="${zip}" />
|
||||
@ -351,15 +352,46 @@
|
||||
|
||||
<target name="whitespace">
|
||||
<replaceregexp match="[\t ]+$" replace="" flags="g" byline="true">
|
||||
<fileset dir="${src.dir}" includes="*.js"/>
|
||||
<fileset dir="${src.dir}/i18n/" includes="*.js"/>
|
||||
<fileset dir="${src.dir}" includes="*.js"/>
|
||||
<fileset dir="${src.dir}/i18n/" includes="*.js"/>
|
||||
</replaceregexp>
|
||||
<echo message="All trailing spaces removed." />
|
||||
</target>
|
||||
|
||||
<target name="size" depends="copy, minify, replace-version, prepend-header" description="Report sizes of files">
|
||||
<echo message="Collecting files to size" />
|
||||
<mkdir dir="${size.dir}" />
|
||||
<copy todir="${size.dir}">
|
||||
<fileset dir="${dist.dir}/ui" includes="*.js" />
|
||||
<fileset dir="${dist.dir}/ui/i18n" includes="*.js" />
|
||||
<fileset dir="${dist.dir}/ui/minified" includes="*.js" />
|
||||
<fileset dir="${dist.dir}/ui/minified/i18n" includes="*.js" />
|
||||
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
|
||||
<fileset dir="${dist.dir}/themes/base/minified" includes="*.css" />
|
||||
</copy>
|
||||
<echo message="GZipping Minified" />
|
||||
<parallel threadsperprocessor="2">
|
||||
<apply executable="gzip">
|
||||
<fileset dir="${size.dir}" includes="*.min.js" />
|
||||
<fileset dir="${size.dir}" includes="*.min.css" />
|
||||
<arg value="-c" />
|
||||
<srcfile />
|
||||
<redirector>
|
||||
<outputmapper id="out" type="glob" from="*" to="${size.dir}/*.gz"/>
|
||||
</redirector>
|
||||
</apply>
|
||||
</parallel>
|
||||
<echo message="Comparing file size with previous build" />
|
||||
<exec executable="bash">
|
||||
<arg value="-c" />
|
||||
<arg value="wc -c ${size.dir}/* | `which node nodejs` build/sizer.js" />
|
||||
</exec>
|
||||
<delete dir="${size.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="cdn">
|
||||
<delete dir="${cdndist.dir}" />
|
||||
<mkdir dir="${cdndist.dir}" />
|
||||
<delete dir="${cdndist.dir}" />
|
||||
<mkdir dir="${cdndist.dir}" />
|
||||
<copy todir="${cdndist.dir}">
|
||||
<fileset dir=".." includes="AUTHORS.txt, GPL-LICENSE.txt, MIT-LICENSE.txt, version.txt" />
|
||||
</copy>
|
||||
@ -378,7 +410,7 @@
|
||||
<fileset dir="${cdndist.dir}" />
|
||||
</checksum>
|
||||
<for param="file">
|
||||
<path><fileset dir="${cdndist.dir}" includes="**/" excludes="**/*.MD5" /></path>
|
||||
<path><fileset dir="${cdndist.dir}" includes="**/" excludes="**/*.MD5" /></path>
|
||||
<sequential>
|
||||
<!-- @{file} is an absolute path, use that ugly regexes to make it relative -->
|
||||
<propertyregex override="yes" property="relativepath" input="@{file}" regexp=".+?cdn[\\/](.+)$" replace="\1"/>
|
||||
@ -394,6 +426,6 @@
|
||||
<zip destfile="${dist.dir}/../${release.filename}-mscdn.zip">
|
||||
<zipfileset dir="dist/${release.filename}-cdn/" />
|
||||
</zip>
|
||||
</target>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
35
build/build/sizer.js
Normal file
35
build/build/sizer.js
Normal file
@ -0,0 +1,35 @@
|
||||
var fs = require( "fs" ),
|
||||
stdin = process.openStdin(),
|
||||
rsize = /(\d+).*?(jquery\S+)/g,
|
||||
oldsizes = {},
|
||||
sizes = {};
|
||||
|
||||
try {
|
||||
oldsizes = JSON.parse( fs.readFileSync( __dirname + "/.sizecache.json", "utf8" ) );
|
||||
} catch(e) {
|
||||
oldsizes = {};
|
||||
};
|
||||
|
||||
stdin.on( "data" , function( chunk ) {
|
||||
var match;
|
||||
|
||||
while ( match = rsize.exec( chunk ) ) {
|
||||
sizes[ match[2] ] = parseInt( match[1], 10 );
|
||||
}
|
||||
});
|
||||
|
||||
function lpad( str, len, chr ) {
|
||||
return ( Array(len+1).join( chr || " ") + str ).substr( -len );
|
||||
}
|
||||
|
||||
stdin.on( "end", function() {
|
||||
fs.writeFileSync( __dirname + "/.sizecache.json", JSON.stringify( sizes, true ), "utf8" );
|
||||
for ( var key in sizes ) {
|
||||
var diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] );
|
||||
if ( diff > 0 ) {
|
||||
diff = "+" + diff;
|
||||
}
|
||||
console.log( "%s %s %s", lpad( sizes[ key ], 8 ), lpad( diff ? "(" + diff + ")" : "(-)", 8 ), key );
|
||||
}
|
||||
process.exit();
|
||||
});
|
Loading…
Reference in New Issue
Block a user