decoupling styles retrieval from the attr method
[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         <taskdef resource="net/sf/antcontrib/antcontrib.properties">
34                 <classpath>
35                         <pathelement location="build/ant-contrib-0.6.jar"/>
36                 </classpath>
37         </taskdef>
38         <exec executable="svn" outputproperty="svnlog.out" >  
39                 <arg line="info ."/>  
40         </exec> 
41         <propertyregex property="revision" input="${svnlog.out}" select="\1">  
42                 <regexp pattern="Revision: ([0-9]*)"/>  
43         </propertyregex>
44         <propertyregex property="date" input="${svnlog.out}" select="\1">  
45                 <regexp pattern="Date: (.+\))"/>  
46         </propertyregex>  
47
48     <!-- MAIN -->
49
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" />
69         </concat>
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." />
74     </target>
75
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" />
81                         </fileset>
82                         <arg line="-jar" />
83                         <arg path="${YUICompressor}" />
84                         <arg value="--charset" />
85                         <arg value="ANSI" />
86                         <arg value="-o" />
87                         <targetfile />
88                         <mapper type="glob" from="jquery.js" to="jquery.min.js" />
89                 </apply>
90         <echo message="${JQ_MIN} built." />
91     </target>
92
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" />
97             <arg value="${JQ}" />
98             <arg value="${JQ_PACK}" />
99         </java>
100         <echo message="${JQ_PACK} built." />
101     </target>
102
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" />
107         </java>
108                 <echo message="Test Suite Finished" />
109         </target>
110
111     <target name="clean">
112         <delete dir="${DIST_DIR}" />
113     </target>
114
115     <target name="all" depends="clean,jquery,min,pack">
116         <echo message="Build complete." />
117     </target>
118         
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}" />
125         </target>
126
127 </project>