Merge branch 'restrictAttr' of https://github.com/jitter/jquery into jitter-restrictAttr
[jquery.git] / build.xml
1 <project name="jQuery" default="all" basedir=".">
2
3         <loadfile property="version" srcfile="version.txt" />
4         <property name="PREFIX" value="." />
5         <property description="Folder for jquery and min target" name="dist" value="${PREFIX}/dist" />
6
7         <property name="JQ" value="${dist}/jquery.js" />
8         <property name="JQ_MIN" value="${dist}/jquery.min.js" />
9
10         <loadfile property="sizzle-exports" srcfile="src/sizzle-jquery.js" />
11
12         <available property="qunit" file="test/qunit" />
13         <available property="sizzle" file="src/sizzle" />
14
15         <target name="all" depends="jquery,lint,min" />
16
17         <target name="qunit-clone" unless="qunit">
18                 <exec executable="git" outputproperty="git-qunit" >
19                         <arg line="clone git://github.com/jquery/qunit.git test/qunit" />
20                 </exec>
21                 <echo message="git clone qunit: ${git-qunit}" />
22         </target>
23         <target name="qunit-pull" if="qunit">
24                 <exec executable="git" outputproperty="git-qunit" dir="test/qunit" >
25                         <arg line="pull origin master" />
26                 </exec>
27                 <echo message="git pull sizzle: ${git-qunit}" />
28         </target>
29         <target name="sizzle-clone" unless="sizzle">
30                 <exec executable="git" outputproperty="git-sizzle" >
31                         <arg line="clone git://github.com/jeresig/sizzle.git src/sizzle" />
32                 </exec>
33                 <echo message="git clone sizzle: ${git-sizzle}" />
34         </target>
35         <target name="sizzle-pull" if="sizzle">
36                 <exec executable="git" outputproperty="git-sizzle" dir="src/sizzle" >
37                         <arg line="pull origin master" />
38                 </exec>
39                 <echo message="git pull sizzle: ${git-sizzle}" />
40         </target>
41
42         <target name="init" depends="qunit-clone,qunit-pull,sizzle-clone,sizzle-pull" />
43
44         <target name="selector" depends="init" description="Builds the selector library for jQuery from Sizzle.">
45                 <copy file="src/sizzle/sizzle.js" tofile="src/selector.js" overwrite="true" />
46                 <replaceregexp match="// EXPOSE(.*)&#10;" replace="// EXPOSE\1&#10;${sizzle-exports}" file="src/selector.js" />
47                 <replaceregexp match="window.Sizzle(.*)&#10;" replace="" file="src/selector.js" />
48         </target>
49
50         <target name="jquery" depends="init,selector" description="Main jquery build, concatenates source files and replaces @VERSION">
51                 <echo message="Building ${JQ}" />
52                 <mkdir dir="${dist}" />
53                 <concat destfile="${JQ}">
54                         <fileset file="src/intro.js" />
55                         <fileset file="src/core.js" />
56                         <fileset file="src/support.js" />
57                         <fileset file="src/data.js" />
58                         <fileset file="src/queue.js" />
59                         <fileset file="src/attributes.js" />
60                         <fileset file="src/event.js" />
61                         <fileset file="src/selector.js" />
62                         <fileset file="src/traversing.js" />
63                         <fileset file="src/manipulation.js" />
64                         <fileset file="src/css.js" />
65                         <fileset file="src/ajax.js" />
66                         <fileset file="src/effects.js" />
67                         <fileset file="src/offset.js" />
68                         <fileset file="src/dimensions.js" />
69                         <fileset file="src/outro.js" />
70                 </concat>
71                 <replaceregexp match="@VERSION" replace="${version}" flags="g" byline="true" file="${JQ}" />
72                 <exec executable="git" outputproperty="date">
73                         <arg line="log -1 --pretty=format:%ad" />
74                 </exec>
75                 <replaceregexp match="Date: " replace="Date: ${date}" file="${JQ}" />
76                 <echo message="${JQ} built." />
77         </target>
78
79         <target name="lint" depends="jquery" description="Check jQuery against JSLint">
80                 <exec executable="java">
81                         <arg line="-jar build/js.jar build/jslint-check.js" />
82                 </exec>
83         </target>
84
85         <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip">
86                 <echo message="Building ${JQ_MIN}" />
87                 <apply executable="java" parallel="false" verbose="true" dest="${dist}">
88                         <fileset dir="${dist}">
89                                 <include name="jquery.js" />
90                         </fileset>
91                         <arg line="-jar" />
92                         <arg path="build/google-compiler-20100917.jar" />
93                         <arg value="--warning_level" />
94                         <arg value="QUIET" />
95                         <arg value="--js_output_file" />
96                         <targetfile />
97                         <arg value="--js" />
98                         <mapper type="glob" from="jquery.js" to="tmpmin" />
99                 </apply>
100                 <concat destfile="${JQ_MIN}">
101                         <filelist files="${JQ}, ${dist}/tmpmin" />
102                         <filterchain>
103                                 <headfilter lines="15" />
104                         </filterchain>
105                 </concat>
106                 <concat destfile="${JQ_MIN}" append="yes">
107                         <filelist files="${dist}/tmpmin" />
108                 </concat>
109                 <delete file="${dist}/tmpmin" />
110                 <echo message="${JQ_MIN} built." />
111         </target>
112
113         <target name="clean">
114                 <delete dir="${dist}" />
115                 <delete file="src/selector.js" />
116                 <delete dir="test/qunit" />
117                 <delete dir="src/sizzle" />
118         </target>
119
120         <target name="openAjaxMetadata">
121                 <property name="target" value="openAjaxMetadata-jquery-${version}.xml" />
122                 <delete file="${dist}/jquery-*.xml" />
123                 <get src="http://www.exfer.net/jquery/createjQueryXMLDocs.py?version=1.3" dest="${target}" />
124                 <xslt includes="${target}" excludes="build.xml" destdir="./dist" style="build/style.xsl" extension=".xml" />
125                 <delete file="${target}" />
126         </target>
127
128 </project>