1 <project name="jQuery" default="jquery" basedir=".">
4 To get jQuery even smaller, remove the modules you don't need by removing the fileset elements
5 in the jquery-target, for example leaving only these:
7 <fileset dir="${SRC_DIR}" includes="intro.js" />
8 <fileset dir="${SRC_DIR}" includes="core.js" />
9 <fileset dir="${SRC_DIR}" includes="selector.js" />
10 <fileset dir="${SRC_DIR}" includes="event.js" />
11 <fileset dir="${SRC_DIR}" includes="outro.js" />
13 That'd remove ajax, fx and offset support, leaving basic selectors, manipulation and event handling.
18 <property description="Source Folder" name="SRC_DIR" value="src" />
19 <property description="Files for parsing etc." name="BUILD_DIR" value="build" />
20 <property description="Rhino JS Engine" name="JAR" value="${BUILD_DIR}/js.jar" />
21 <property description="YUICompressor" name="YUICompressor" value="${BUILD_DIR}/yuicompressor-2.4.2.jar" />
22 <loadfile description="Version to build" property="version" srcfile="version.txt" />
24 <property description="Folder for jquery, min, lite and packed target" name="DIST_DIR" value="./dist" />
26 <!-- Files names for distribution -->
27 <property name="JQ" value="${DIST_DIR}/jquery.js" />
28 <property name="JQ_LITE" value="${DIST_DIR}/jquery.lite.js" />
29 <property name="JQ_MIN" value="${DIST_DIR}/jquery.min.js" />
30 <property name="JQ_PACK" value="${DIST_DIR}/jquery.pack.js" />
31 <loadfile property="version" srcfile="version.txt" />
33 <taskdef resource="net/sf/antcontrib/antcontrib.properties">
35 <pathelement location="build/ant-contrib-0.6.jar"/>
38 <exec executable="svn" outputproperty="svnlog.out" >
41 <propertyregex property="revision" input="${svnlog.out}" select="\1">
42 <regexp pattern="Revision: ([0-9]*)"/>
44 <propertyregex property="date" input="${svnlog.out}" select="\1">
45 <regexp pattern="Date: (.+\))"/>
50 <target name="jquery" description="Main jquery build, concatenates source files and replaces @VERSION">
51 <echo message="Building ${JQ}" />
52 <mkdir dir="${DIST_DIR}" />
53 <concat destfile="${JQ}">
54 <fileset dir="${SRC_DIR}" includes="intro.js" />
55 <fileset dir="${SRC_DIR}" includes="core.js" />
56 <fileset dir="${SRC_DIR}" includes="data.js" />
57 <fileset dir="${SRC_DIR}" includes="selector.js" />
58 <fileset dir="${SRC_DIR}" includes="traversing.js" />
59 <fileset dir="${SRC_DIR}" includes="attributes.js" />
60 <fileset dir="${SRC_DIR}" includes="manipulation.js" />
61 <fileset dir="${SRC_DIR}" includes="event.js" />
62 <fileset dir="${SRC_DIR}" includes="support.js" />
63 <fileset dir="${SRC_DIR}" includes="css.js" />
64 <fileset dir="${SRC_DIR}" includes="ajax.js" />
65 <fileset dir="${SRC_DIR}" includes="fx.js" />
66 <fileset dir="${SRC_DIR}" includes="offset.js" />
67 <fileset dir="${SRC_DIR}" includes="dimensions.js" />
68 <fileset dir="${SRC_DIR}" includes="outro.js" />
70 <replaceregexp match="@VERSION" replace="${version}" flags="g" byline="true" file="${JQ}" />
71 <replaceregexp match="Date: " replace="Date: ${date}" file="${JQ}" />
72 <replaceregexp match="Revision: " replace="Revision: ${revision}" file="${JQ}" />
73 <echo message="${JQ} built." />
76 <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip">
77 <echo message="Building ${JQ_MIN}" />
78 <apply executable="java" parallel="false" verbose="true" dest="${DIST_DIR}">
79 <fileset dir="${DIST_DIR}">
80 <include name="jquery.js" />
83 <arg path="${YUICompressor}" />
84 <arg value="--charset" />
88 <mapper type="glob" from="jquery.js" to="jquery.min.js" />
90 <echo message="${JQ_MIN} built." />
93 <target name="pack" depends="jquery" description="Remove all comments and whitespace and compress">
94 <echo message="Building ${JQ_PACK}" />
95 <java jar="${JAR}" fork="true">
96 <arg value="${BUILD_DIR}/build/pack.js" />
98 <arg value="${JQ_PACK}" />
100 <echo message="${JQ_PACK} built." />
103 <target name="runtest">
104 <echo message="Running Automated Test Suite" />
105 <java jar="${JAR}" fork="true">
106 <arg value="${BUILD_DIR}/runtest/test.js" />
108 <echo message="Test Suite Finished" />
111 <target name="clean">
112 <delete dir="${DIST_DIR}" />
115 <target name="all" depends="clean,jquery,min,pack">
116 <echo message="Build complete." />
119 <target name="openAjaxMetadata">
120 <property name="target" value="openAjaxMetadata-jquery-${version}.xml" />
121 <delete file="dist/jquery-*.xml" />
122 <get src="http://www.exfer.net/jquery/createjQueryXMLDocs.py?version=1.3" dest="${target}" />
123 <xslt includes="${target}" excludes="build.xml" destdir="./dist" style="build/style.xsl" extension=".xml" />
124 <delete file="${target}" />