e2a415a93e5e23d153597a1c3dde44d4589b3ced
[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         -->\r
18 \r
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" />\r
24 \r
25         <property description="Dir to look for plugins" name="PLUGIN_DIR" location="../plugins" />\r
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" />\r
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" />\r
40 \r
41         <!-- MAIN -->\r
42 \r
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}">\r
47                         <fileset dir="${SRC_DIR}" includes="intro.js" />
48                         <fileset dir="${SRC_DIR}" includes="jquery/jquery.js" />
49                         <fileset dir="${SRC_DIR}" includes="event/event.js" />
50                         <fileset dir="${SRC_DIR}" includes="fx/fx.js" />
51                         <fileset dir="${SRC_DIR}" includes="ajax/ajax.js" />\r
52                         <fileset dir="${PLUGIN_DIR}" includes="${PLUGINS}" />\r
53                         <fileset dir="${SRC_DIR}" includes="outro.js" />
54                 </concat>
55                 <echo message="${JQ} built." />
56         </target>
57
58         <target name="jquery_with_plugins" description="Build jquery with all plugins, useful to full documentation">
59                 <antcall target="jquery">
60                         <param name="PLUGINS" value="${PLUGINS_ALL}" />
61                 </antcall>\r
62         </target>
63
64         <target name="lite" depends="jquery" description="Remove all /** */ comments">
65                 <echo message="Building ${JQ_LITE}" />
66                 <java jar="${JAR}" fork="true">
67                         <arg value="${BUILD_DIR}/build/lite.js" />
68                         <arg value="${JQ}" />
69                         <arg value="${JQ_LITE}" />
70                 </java>
71                 <echo message="${JQ_LITE} built." />
72         </target>
73
74         <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression">
75                 <echo message="Building ${JQ_MIN}" />
76                 <java jar="${JAR}" fork="true">
77                         <arg value="${BUILD_DIR}/build/min.js" />
78                         <arg value="${JQ}" />
79                         <arg value="${JQ_MIN}" />
80                 </java>
81                 <echo message="${JQ_MIN} built." />
82         </target>
83
84         <target name="pack" depends="jquery" description="Remove all comments and whitespace and compress">
85                 <echo message="Building ${JQ_PACK}" />
86                 <java jar="${JAR}" fork="true">
87                         <arg value="${BUILD_DIR}/build/pack.js" />
88                         <arg value="${JQ}" />
89                         <arg value="${JQ_PACK}" />
90                 </java>
91                 <echo message="${JQ_PACK} built." />
92         </target>\r
93 \r
94         <target name="pack_with_plugins" depends="jquery_with_plugins" description="Pack jquery with all plugins, not very useful">\r
95                 <echo message="Building ${JQ_PACK}" />\r
96                 <java jar="${JAR}" fork="true">\r
97                         <arg value="${BUILD_DIR}/build/pack.js" />\r
98                         <arg value="${JQ}" />\r
99                         <arg value="${JQ_PACK}" />\r
100                 </java>\r
101                 <echo message="${JQ_PACK} built." />\r
102         </target>
103
104         <target name="test" depends="jquery" description="Copy files for the test suite into their own directory.">
105                 <echo message="Building Test Suite" />
106                 <delete dir="${TEST_DIR}" />
107                 <mkdir dir="${TEST_DIR}/data" />\r
108                 <copy todir="${TEST_DIR}/data">\r
109                         <fileset dir="${BUILD_DIR}/test/data/" />\r
110                 </copy>
111                 <copy todir="${TEST_DIR}" file="${BUILD_DIR}/test/index.html" />
112                 <echo message="Test Suite built." />
113         </target>
114
115         <target name="docs" depends="jquery" description="Reads inline docs from source and compiles into xml file">
116                 <echo message="Building Documentation" />
117                 <delete dir="${DOCS_DIR}" />
118                 <mkdir dir="${DOCS_DIR}/data" />
119                 <copy todir="${DOCS_DIR}" file="${BUILD_DIR}/docs/.htaccess" />
120                 <mkdir dir="${DOCS_DIR}/js" />
121                 <copy todir="${DOCS_DIR}/js">
122                         <fileset dir="${BUILD_DIR}/docs/js">
123                                 <include name="**/*.js" />
124                         </fileset>
125                 </copy>
126                 <copy todir="${DOCS_DIR}/style">
127                         <fileset dir="${BUILD_DIR}/docs/style">
128                                 <include name="**" />
129                         </fileset>
130                 </copy>
131                 <java jar="${JAR}" fork="true">
132                         <arg value="${BUILD_DIR}/docs/docs.js" />
133                         <arg value="${JQ}" />
134                         <arg value="${DOCS_DIR}" />
135                 </java>
136                 <echo message="Documentation built." />
137         </target>\r
138
139         <!-- TODO refactor to remove duplication with above -->\r
140         <target name="docs_with_plugins" depends="jquery_with_plugins">\r
141                 <echo message="Building Documentation" />\r
142                 <delete dir="${DOCS_DIR}" />\r
143                 <mkdir dir="${DOCS_DIR}/data" />\r
144                 <copy todir="${DOCS_DIR}" file="${BUILD_DIR}/docs/.htaccess" />\r
145                 <mkdir dir="${DOCS_DIR}/js" />\r
146                 <copy todir="${DOCS_DIR}/js">\r
147                         <fileset dir="${BUILD_DIR}/docs/js">\r
148                                 <include name="**/*.js" />\r
149                         </fileset>\r
150                 </copy>\r
151                 <copy todir="${DOCS_DIR}/style">\r
152                         <fileset dir="${BUILD_DIR}/docs/style">\r
153                                 <include name="**" />\r
154                         </fileset>\r
155                 </copy>\r
156                 <java jar="${JAR}" fork="true">\r
157                         <arg value="${BUILD_DIR}/docs/docs.js" />\r
158                         <arg value="${JQ}" />\r
159                         <arg value="${DOCS_DIR}" />\r
160                 </java>\r
161                 <echo message="Documentation built." />\r
162         </target>
163
164         <target name="clean">
165                 <delete dir="${DOCS_DIR}" />
166                 <delete dir="${TEST_DIR}" />
167                 <delete dir="${DIST_DIR}" />
168         </target>
169
170         <target name="all" depends="clean,jquery,lite,min,pack,docs,test">
171                 <echo message="Build complete." />
172         </target>
173         
174         <!-- Extra stuff for Tabs plugin -->
175         
176         <property name="TABS" value="${PLUGIN_DIR}/tabs/tabs.js" />
177         <property name="TABS_PACK" value="${DIST_DIR}/jquery.tabs.pack.js" />
178
179         <target name="pack_tabs">\r
180                 <echo message="Building ${TABS_PACK}" />\r
181                 <mkdir dir="${DIST_DIR}" />\r
182                 <java jar="${JAR}" fork="true">\r
183                         <arg value="${BUILD_DIR}/build/pack.js" />\r
184                         <arg value="${TABS}" />\r
185                         <arg value="${TABS_PACK}" />\r
186                 </java>\r
187                 <echo message="${TABS_PACK} built." />\r
188         </target>\r
189
190 </project>