selectedIndex is now cloned cross-browser (#1294)
[jquery.git] / build.xml
1 <project name="jQuery" default="all" basedir=".">
2
3     <!--
4     - Using this build file to create your own custom distribution -
5
6     If you want to include jQuery on your site with a certain set of plugins,
7     follow these steps to create your custom build:
8
9     1. Copy the plugins you need to the plugins folder (if you haven't already, checkout
10        the plugins folder from SVN.
11     2. Modify the PLUGINS property to include all plugins you want, see PLUGINS_ALL for syntax
12        eg. if you need form and tabs plugin, set the value for PLUGINS to this:
13        form/*.js, tabs/*.js
14     3. Execute the standard jquery and packed targets to build your distribution
15
16     TODO Using this build file to create docs for a single plugin
17     -->
18
19     <!-- SETUP -->
20
21     <property description="Source Folder" name="SRC_DIR" value="src" />
22     <property description="Files for parsing etc." name="BUILD_DIR" value="build" />
23     <property description="Rhino JS Engine" name="JAR" value="${BUILD_DIR}/js.jar" />
24
25     <property description="Dir to look for plugins" name="PLUGIN_DIR" location="../plugins" />
26     <property description="Add single plugins here" name="PLUGINS" value="none" />
27     <property description="Add all plugins here" name="PLUGINS_ALL"
28         value="button/*.js,center/*.js,cookie/*.js,form/*.js,greybox/*.js,interface/*.js,pager/*.js,tablesorter/*.js,tabs/*.js,tooltip/*.js,accordion/*.js" />
29
30     <property description="Target parent folder for built files" name="PREFIX" value="." />
31     <property description="Folder for docs target" name="DOCS_DIR" value="${PREFIX}/docs" />
32     <property description="Folder for test target" name="TEST_DIR" value="${PREFIX}/test" />
33     <property description="Folder for jquery, min, lite and packed target" name="DIST_DIR" value="${PREFIX}/dist" />
34
35     <!-- Files names for distribution -->
36     <property name="JQ" value="${DIST_DIR}/jquery.js" />
37     <property name="JQ_LITE" value="${DIST_DIR}/jquery.lite.js" />
38     <property name="JQ_MIN" value="${DIST_DIR}/jquery.min.js" />
39     <property name="JQ_PACK" value="${DIST_DIR}/jquery.pack.js" />
40
41     <!-- MAIN -->
42
43     <target name="jquery" description="Main jquery build, set PLUGINS property to include plugins">
44         <echo message="Building ${JQ}" />
45         <mkdir dir="${DIST_DIR}" />
46         <concat destfile="${JQ}">
47             <fileset dir="${SRC_DIR}" includes="intro.js" />
48             <fileset dir="${SRC_DIR}" includes="jquery/jquery.js" />
49             <fileset dir="${SRC_DIR}" includes="selector/selector.js" />
50             <fileset dir="${SRC_DIR}" includes="event/event.js" />
51             <fileset dir="${SRC_DIR}" includes="fx/fx.js" />
52             <fileset dir="${SRC_DIR}" includes="ajax/ajax.js" />
53             <fileset dir="${PLUGIN_DIR}" includes="${PLUGINS}" />
54             <fileset dir="${SRC_DIR}" includes="outro.js" />
55         </concat>
56         <echo message="${JQ} built." />
57     </target>
58
59     <target name="jquery_with_plugins" description="Build jquery with all plugins, useful to full documentation">
60         <antcall target="jquery">
61             <param name="PLUGINS" value="${PLUGINS_ALL}" />
62         </antcall>
63     </target>
64
65     <target name="lite" depends="jquery" description="Remove all /** */ comments">
66         <echo message="Building ${JQ_LITE}" />
67         <java jar="${JAR}" fork="true">
68             <arg value="${BUILD_DIR}/build/lite.js" />
69             <arg value="${JQ}" />
70             <arg value="${JQ_LITE}" />
71         </java>
72         <echo message="${JQ_LITE} built." />
73     </target>
74
75     <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression">
76         <echo message="Building ${JQ_MIN}" />
77         <java jar="${JAR}" fork="true">
78             <arg value="${BUILD_DIR}/build/min.js" />
79             <arg value="${JQ}" />
80             <arg value="${JQ_MIN}" />
81         </java>
82         <echo message="${JQ_MIN} built." />
83     </target>
84
85     <target name="pack" depends="jquery" description="Remove all comments and whitespace and compress">
86         <echo message="Building ${JQ_PACK}" />
87         <java jar="${JAR}" fork="true">
88             <arg value="${BUILD_DIR}/build/pack.js" />
89             <arg value="${JQ}" />
90             <arg value="${JQ_PACK}" />
91         </java>
92         <echo message="${JQ_PACK} built." />
93     </target>
94
95     <target name="pack_with_plugins" depends="jquery_with_plugins" description="Pack jquery with all plugins, not very useful">
96         <echo message="Building ${JQ_PACK}" />
97         <java jar="${JAR}" fork="true">
98             <arg value="${BUILD_DIR}/build/pack.js" />
99             <arg value="${JQ}" />
100             <arg value="${JQ_PACK}" />
101         </java>
102         <echo message="${JQ_PACK} built." />
103     </target>
104
105     <target name="test" depends="jquery" description="Copy files for the test suite into their own directory.">
106         <echo message="Building Test Suite" />
107         <delete dir="${TEST_DIR}" />
108         <mkdir dir="${TEST_DIR}/data" />
109         <copy todir="${TEST_DIR}/data">
110             <fileset dir="${BUILD_DIR}/test/data/" />
111         </copy>
112         <copy todir="${TEST_DIR}" file="${BUILD_DIR}/test/index.html" />
113         <copy todir="${TEST_DIR}" file="${BUILD_DIR}/test/fx.html" />
114         <copy todir="${TEST_DIR}" file="${BUILD_DIR}/test/cow.jpg" />
115         <echo message="Test Suite built." />
116     </target>
117
118     <target name="docs" depends="jquery" description="Reads inline docs from source and compiles into xml file">
119         <echo message="Building Documentation" />
120         <delete dir="${DOCS_DIR}" />
121         <mkdir dir="${DOCS_DIR}/data" />
122         <copy todir="${DOCS_DIR}" file="${BUILD_DIR}/docs/.htaccess" />
123         <mkdir dir="${DOCS_DIR}/js" />
124         <copy todir="${DOCS_DIR}/js">
125             <fileset dir="${BUILD_DIR}/docs/js">
126                 <include name="**/*.js" />
127             </fileset>
128         </copy>
129         <copy todir="${DOCS_DIR}/style">
130             <fileset dir="${BUILD_DIR}/docs/style">
131                 <include name="**" />
132             </fileset>
133         </copy>
134         <java jar="${JAR}" fork="true">
135             <arg value="${BUILD_DIR}/docs/docs.js" />
136             <arg value="${JQ}" />
137             <arg value="${DOCS_DIR}" />
138         </java>
139         <echo message="Documentation built." />
140     </target>
141
142     <!-- TODO refactor to remove duplication with above -->
143     <target name="docs_with_plugins" depends="jquery_with_plugins">
144         <echo message="Building Documentation" />
145         <delete dir="${DOCS_DIR}" />
146         <mkdir dir="${DOCS_DIR}/data" />
147         <copy todir="${DOCS_DIR}" file="${BUILD_DIR}/docs/.htaccess" />
148         <mkdir dir="${DOCS_DIR}/js" />
149         <copy todir="${DOCS_DIR}/js">
150             <fileset dir="${BUILD_DIR}/docs/js">
151                 <include name="**/*.js" />
152             </fileset>
153         </copy>
154         <copy todir="${DOCS_DIR}/style">
155             <fileset dir="${BUILD_DIR}/docs/style">
156                 <include name="**" />
157             </fileset>
158         </copy>
159         <java jar="${JAR}" fork="true">
160             <arg value="${BUILD_DIR}/docs/docs.js" />
161             <arg value="${JQ}" />
162             <arg value="${DOCS_DIR}" />
163         </java>
164         <echo message="Documentation built." />
165     </target>\r
166         \r
167         <target name="runtest">\r
168                 <echo message="Running Automated Test Suite" />\r
169                 <java jar="${JAR}" fork="true">\r
170             <arg value="${BUILD_DIR}/runtest/test.js" />\r
171         </java>\r
172                 <echo message="Test Suite Finished" />\r
173         </target>
174
175     <target name="clean">
176         <delete dir="${DOCS_DIR}" />
177         <delete dir="${TEST_DIR}" />
178         <delete dir="${DIST_DIR}" />
179     </target>
180
181     <target name="all" depends="clean,jquery,lite,min,pack,docs,test">
182         <echo message="Build complete." />
183     </target>
184
185 </project>