Use array.indexOf if available (speeds up modern browsers). Thanks to lrbabe and...
[jquery.git] / build.xml
blob5235347b411b453a1cc8d2708b135b8e32068ca7
1 <project name="jQuery" default="jquery" basedir=".">
3     <!--
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.
14     -->
16     <!-- SETUP -->
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="YUICompressor" name="YUICompressor" value="${BUILD_DIR}/yuicompressor-2.4.2.jar" />
21         <loadfile description="Version to build" property="version" srcfile="version.txt" />
23     <property description="Folder for jquery, min, lite and packed target" name="DIST_DIR" value="./dist" />
25     <!-- Files names for distribution -->
26     <property name="JQ" value="${DIST_DIR}/jquery.js" />
27     <property name="JQ_LITE" value="${DIST_DIR}/jquery.lite.js" />
28     <property name="JQ_MIN" value="${DIST_DIR}/jquery.min.js" />
29     <property name="JQ_PACK" value="${DIST_DIR}/jquery.pack.js" />
30         <loadfile property="version" srcfile="version.txt" />
32     <!-- MAIN -->
34     <target name="jquery" description="Main jquery build, concatenates source files and replaces @VERSION">
35         <echo message="Building ${JQ}" />
36         <mkdir dir="${DIST_DIR}" />
37         <concat destfile="${JQ}">
38             <fileset dir="${SRC_DIR}" includes="intro.js" />
39             <fileset dir="${SRC_DIR}" includes="core.js" />
40             <fileset dir="${SRC_DIR}" includes="data.js" />
41             <fileset dir="${SRC_DIR}" includes="event.js" />
42             <fileset dir="${SRC_DIR}" includes="support.js" />
43             <fileset dir="${SRC_DIR}" includes="selector.js" />
44             <fileset dir="${SRC_DIR}" includes="traversing.js" />
45             <fileset dir="${SRC_DIR}" includes="attributes.js" />
46             <fileset dir="${SRC_DIR}" includes="manipulation.js" />
47             <fileset dir="${SRC_DIR}" includes="css.js" />
48             <fileset dir="${SRC_DIR}" includes="ajax.js" />
49             <fileset dir="${SRC_DIR}" includes="fx.js" />
50             <fileset dir="${SRC_DIR}" includes="offset.js" />
51             <fileset dir="${SRC_DIR}" includes="dimensions.js" />
52             <fileset dir="${SRC_DIR}" includes="outro.js" />
53         </concat>
54         <replaceregexp match="@VERSION" replace="${version}" flags="g" byline="true" file="${JQ}" />
55                 <replaceregexp match="Date: " replace="Date: ${date}" file="${JQ}" />
56                 <replaceregexp match="Revision: " replace="Revision: ${revision}" file="${JQ}" />
57         <echo message="${JQ} built." />
58     </target>
60     <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip">
61         <echo message="Building ${JQ_MIN}" />
62                 <apply executable="java" parallel="false" verbose="true" dest="${DIST_DIR}">
63                         <fileset dir="${DIST_DIR}">
64                                 <include name="jquery.js" />
65                         </fileset>
66                         <arg line="-jar" />
67                         <arg path="${YUICompressor}" />
68                         <arg value="--charset" />
69                         <arg value="ANSI" />
70                         <arg value="-o" />
71                         <targetfile />
72                         <mapper type="glob" from="jquery.js" to="jquery.min.js" />
73                 </apply>
74         <echo message="${JQ_MIN} built." />
75     </target>
77     <target name="pack" depends="jquery" description="Remove all comments and whitespace and compress">
78         <echo message="Building ${JQ_PACK}" />
79         <java jar="${JAR}" fork="true">
80             <arg value="${BUILD_DIR}/build/pack.js" />
81             <arg value="${JQ}" />
82             <arg value="${JQ_PACK}" />
83         </java>
84         <echo message="${JQ_PACK} built." />
85     </target>
87         <target name="runtest">
88                 <echo message="Running Automated Test Suite" />
89                 <java jar="${JAR}" fork="true">
90             <arg value="${BUILD_DIR}/runtest/test.js" />
91         </java>
92                 <echo message="Test Suite Finished" />
93         </target>
95     <target name="clean">
96         <delete dir="${DIST_DIR}" />
97     </target>
99     <target name="all" depends="clean,jquery,min,pack">
100         <echo message="Build complete." />
101     </target>
102         
103         <target name="openAjaxMetadata">
104                 <property name="target" value="openAjaxMetadata-jquery-${version}.xml" />
105                 <delete file="dist/jquery-*.xml" />
106                 <get src="http://www.exfer.net/jquery/createjQueryXMLDocs.py?version=1.3" dest="${target}" />
107                 <xslt includes="${target}" excludes="build.xml" destdir="./dist" style="build/style.xsl" extension=".xml" />
108                 <delete file="${target}" />
109         </target>
111 </project>