Simplified cross-domain detection tests.
[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/ajax/jsonp.js" />
67                         <fileset file="src/ajax/script.js" />
68                         <fileset file="src/ajax/xhr.js" />
69                         <fileset file="src/effects.js" />
70                         <fileset file="src/offset.js" />
71                         <fileset file="src/dimensions.js" />
72                         <fileset file="src/outro.js" />
73                 </concat>
74                 <replaceregexp match="@VERSION" replace="${version}" flags="g" byline="true" file="${JQ}" />
75                 <exec executable="git" outputproperty="date">
76                         <arg line="log -1 --pretty=format:%ad" />
77                 </exec>
78                 <replaceregexp match="(\(\s*function\s*\(\s*jQuery\s*\)\s*\{)|(\}\s*\)\s*\(\s*jQuery\s*\)\s*;)" flags="g" replace="" file="${JQ}" />
79                 <replaceregexp match="@DATE" replace="${date}" file="${JQ}" />
80                 <echo message="${JQ} built." />
81         </target>
82
83         <target name="lint" depends="jquery" description="Check jQuery against JSLint">
84                 <exec executable="java">
85                         <arg line="-jar build/js.jar build/jslint-check.js" />
86                 </exec>
87         </target>
88
89         <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip">
90                 <echo message="Building ${JQ_MIN}" />
91                 <apply executable="java" parallel="false" verbose="true" dest="${dist}">
92                         <fileset dir="${dist}">
93                                 <include name="jquery.js" />
94                         </fileset>
95                         <arg line="-jar" />
96                         <arg path="build/google-compiler-20100917.jar" />
97                         <arg value="--warning_level" />
98                         <arg value="QUIET" />
99                         <arg value="--js_output_file" />
100                         <targetfile />
101                         <arg value="--js" />
102                         <mapper type="glob" from="jquery.js" to="tmpmin" />
103                 </apply>
104                 <concat destfile="${JQ_MIN}">
105                         <filelist files="${JQ}, ${dist}/tmpmin" />
106                         <filterchain>
107                                 <headfilter lines="15" />
108                         </filterchain>
109                 </concat>
110                 <concat destfile="${JQ_MIN}" append="yes">
111                         <filelist files="${dist}/tmpmin" />
112                 </concat>
113                 <delete file="${dist}/tmpmin" />
114                 <echo message="${JQ_MIN} built." />
115         </target>
116
117         <target name="clean">
118                 <delete dir="${dist}" />
119                 <delete file="src/selector.js" />
120                 <delete dir="test/qunit" />
121                 <delete dir="src/sizzle" />
122         </target>
123
124         <target name="openAjaxMetadata">
125                 <property name="target" value="openAjaxMetadata-jquery-${version}.xml" />
126                 <delete file="${dist}/jquery-*.xml" />
127                 <get src="http://www.exfer.net/jquery/createjQueryXMLDocs.py?version=1.3" dest="${target}" />
128                 <xslt includes="${target}" excludes="build.xml" destdir="./dist" style="build/style.xsl" extension=".xml" />
129                 <delete file="${target}" />
130         </target>
131
132 </project>