core: replaced version.js build script in ant build; wasn't used in make anymore...
[jquery.git] / build.xml
1 <project name="jQuery" default="jquery" basedir=".">
2
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:
6
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" />
12
13         That'd remove ajax, fx and offset support, leaving basic selectors, manipulation and event handling.
14     -->
15
16     <!-- SETUP -->
17
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" />
23
24     <property description="Folder for jquery, min, lite and packed target" name="DIST_DIR" value="./dist" />
25
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" />
32
33     <!-- MAIN -->
34
35     <target name="jquery" description="Main jquery build, concatenates source files and replaces @VERSION">
36         <echo message="Building ${JQ}" />
37         <mkdir dir="${DIST_DIR}" />
38         <concat destfile="${JQ}">
39             <fileset dir="${SRC_DIR}" includes="intro.js" />
40             <fileset dir="${SRC_DIR}" includes="core.js" />
41             <fileset dir="${SRC_DIR}" includes="data.js" />
42             <fileset dir="${SRC_DIR}" includes="selector.js" />
43             <fileset dir="${SRC_DIR}" includes="event.js" />
44             <fileset dir="${SRC_DIR}" includes="support.js" />
45             <fileset dir="${SRC_DIR}" includes="ajax.js" />
46             <fileset dir="${SRC_DIR}" includes="fx.js" />
47             <fileset dir="${SRC_DIR}" includes="offset.js" />
48             <fileset dir="${SRC_DIR}" includes="dimensions.js" />
49             <fileset dir="${SRC_DIR}" includes="outro.js" />
50         </concat>
51         <replaceregexp match="@VERSION" replace="${version}" flags="g" byline="true" file="${JQ}" />
52         <echo message="${JQ} built." />
53     </target>
54
55     <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip">
56         <echo message="Building ${JQ_MIN}" />
57                 <apply executable="java" parallel="false" verbose="true" dest="${DIST_DIR}">
58                         <fileset dir="${DIST_DIR}">
59                                 <include name="jquery.js" />
60                         </fileset>
61                         <arg line="-jar" />
62                         <arg path="${YUICompressor}" />
63                         <arg value="--charset" />
64                         <arg value="ANSI" />
65                         <arg value="-o" />
66                         <targetfile />
67                         <mapper type="glob" from="jquery.js" to="jquery.min.js" />
68                 </apply>
69         <echo message="${JQ_MIN} built." />
70     </target>
71
72     <target name="pack" depends="jquery" description="Remove all comments and whitespace and compress">
73         <echo message="Building ${JQ_PACK}" />
74         <java jar="${JAR}" fork="true">
75             <arg value="${BUILD_DIR}/build/pack.js" />
76             <arg value="${JQ}" />
77             <arg value="${JQ_PACK}" />
78         </java>
79         <echo message="${JQ_PACK} built." />
80     </target>
81
82         <target name="runtest">
83                 <echo message="Running Automated Test Suite" />
84                 <java jar="${JAR}" fork="true">
85             <arg value="${BUILD_DIR}/runtest/test.js" />
86         </java>
87                 <echo message="Test Suite Finished" />
88         </target>
89
90     <target name="clean">
91         <delete dir="${DIST_DIR}" />
92     </target>
93
94     <target name="all" depends="clean,jquery,min,pack">
95         <echo message="Build complete." />
96     </target>
97         
98         <target name="openAjaxMetadata">
99                 <property name="target" value="openAjaxMetadata-jquery-${version}.xml" />
100                 <delete file="dist/jquery-*.xml" />
101                 <get src="http://www.exfer.net/jquery/createjQueryXMLDocs.py?version=1.3" dest="${target}" />
102                 <xslt includes="${target}" excludes="build.xml" destdir="./dist" style="build/style.xsl" extension=".xml" />
103                 <delete file="${target}" />
104         </target>
105
106 </project>