core: Ant target to generate openAjaxMetadata; uses http://www.exfer.net/jquery/creat...
[jquery.git] / build.xml
index 4a598ea..f49d3dd 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,61 +1,77 @@
-<project name="jQuery" default="all" basedir=".">\r
-       \r
-       <!-- SETUP -->
+<project name="jQuery" default="jquery" basedir=".">
 
-    <property name="SRC_DIR" value="src" />
-    <property name="BUILD_DIR" value="build" />
-    <property name="JAR" value="${BUILD_DIR}/js.jar" />\r
-       \r
-       <property name="PLUGIN_DIR" location="../plugins" />
+    <!--
+    To get jQuery even smaller, remove the modules you don't need by removing the fileset elements
+       in the jquery-target, for example leaving only these:
 
-    <property name="PREFIX" value="." />
-    <property name="DOCS_DIR" value="${PREFIX}/docs" />
-    <property name="TEST_DIR" value="${PREFIX}/test" />
-    <property name="DIST_DIR" value="${PREFIX}/dist" />
+       <fileset dir="${SRC_DIR}" includes="intro.js" />
+    <fileset dir="${SRC_DIR}" includes="core.js" />
+    <fileset dir="${SRC_DIR}" includes="selector.js" />
+    <fileset dir="${SRC_DIR}" includes="event.js" />
+    <fileset dir="${SRC_DIR}" includes="outro.js" />
 
+       That'd remove ajax, fx and offset support, leaving basic selectors, manipulation and event handling.
+    -->
+
+    <!-- SETUP -->
+
+    <property description="Source Folder" name="SRC_DIR" value="src"  />
+    <property description="Files for parsing etc." name="BUILD_DIR" value="build" />
+    <property description="Rhino JS Engine" name="JAR" value="${BUILD_DIR}/js.jar" />
+    <property description="YUICompressor" name="YUICompressor" value="${BUILD_DIR}/yuicompressor-2.4.2.jar" />
+       <loadfile description="Version to build" property="version" srcfile="version.txt" />
+
+    <property description="Folder for jquery, min, lite and packed target" name="DIST_DIR" value="./dist" />
+
+    <!-- Files names for distribution -->
     <property name="JQ" value="${DIST_DIR}/jquery.js" />
     <property name="JQ_LITE" value="${DIST_DIR}/jquery.lite.js" />
     <property name="JQ_MIN" value="${DIST_DIR}/jquery.min.js" />
-    <property name="JQ_PACK" value="${DIST_DIR}/jquery.pack.js" />\r
-       <property name="JQ_TEMP" value="${DIST_DIR}/jquery.js.tmp" />
-\r
-       <!-- MAIN -->\r
-       \r
-    <target name="jquery">
+    <property name="JQ_PACK" value="${DIST_DIR}/jquery.pack.js" />
+
+    <!-- MAIN -->
+
+    <target name="jquery" description="Main jquery build, concatenates source files and replaces @VERSION">
         <echo message="Building ${JQ}" />
         <mkdir dir="${DIST_DIR}" />
-        <concat destfile="${JQ}">\r
-               <fileset dir="${SRC_DIR}" includes="intro.js" />
-            <fileset dir="${SRC_DIR}" includes="jquery/*.js" />
-            <fileset dir="${SRC_DIR}" includes="event/*.js" />
-            <fileset dir="${SRC_DIR}" includes="fx/*.js" />
-            <fileset dir="${SRC_DIR}" includes="ajax/*.js" />\r
-               <fileset dir="${SRC_DIR}" includes="outro.js" />
+        <concat destfile="${JQ}">
+            <fileset dir="${SRC_DIR}" includes="intro.js" />
+            <fileset dir="${SRC_DIR}" includes="core.js" />
+            <fileset dir="${SRC_DIR}" includes="data.js" />
+            <fileset dir="${SRC_DIR}" includes="selector.js" />
+            <fileset dir="${SRC_DIR}" includes="event.js" />
+            <fileset dir="${SRC_DIR}" includes="support.js" />
+            <fileset dir="${SRC_DIR}" includes="ajax.js" />
+            <fileset dir="${SRC_DIR}" includes="fx.js" />
+            <fileset dir="${SRC_DIR}" includes="offset.js" />
+            <fileset dir="${SRC_DIR}" includes="dimensions.js" />
+            <fileset dir="${SRC_DIR}" includes="outro.js" />
         </concat>
-        <echo message="${JQ} built." />
-    </target>
-
-    <target name="lite" depends="jquery">
-        <echo message="Building ${JQ_LITE}" />
-        <java jar="${JAR}" fork="true">
-            <arg value="${BUILD_DIR}/build/lite.js" />
+       <java jar="${JAR}" fork="true">
+            <arg value="${BUILD_DIR}/build/version.js" />
             <arg value="${JQ}" />
-            <arg value="${JQ_LITE}" />
         </java>
-        <echo message="${JQ_LITE} built." />
+        <echo message="${JQ} built." />
     </target>
 
-    <target name="min" depends="jquery">
+    <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip">
         <echo message="Building ${JQ_MIN}" />
-        <java jar="${JAR}" fork="true">
-            <arg value="${BUILD_DIR}/build/min.js" />
-            <arg value="${JQ}" />
-            <arg value="${JQ_MIN}" />
-        </java>
+               <apply executable="java" parallel="false" verbose="true" dest="${DIST_DIR}">
+                       <fileset dir="${DIST_DIR}">
+                               <include name="jquery.js" />
+                       </fileset>
+                       <arg line="-jar" />
+                       <arg path="${YUICompressor}" />
+                       <arg value="--charset" />
+                       <arg value="ANSI" />
+                       <arg value="-o" />
+                       <targetfile />
+                       <mapper type="glob" from="jquery.js" to="jquery.min.js" />
+               </apply>
         <echo message="${JQ_MIN} built." />
     </target>
 
-    <target name="pack" depends="jquery">
+    <target name="pack" depends="jquery" description="Remove all comments and whitespace and compress">
         <echo message="Building ${JQ_PACK}" />
         <java jar="${JAR}" fork="true">
             <arg value="${BUILD_DIR}/build/pack.js" />
         <echo message="${JQ_PACK} built." />
     </target>
 
-    <target name="test" depends="jquery">
-        <echo message="Building Test Suite" />
-        <delete dir="${TEST_DIR}" />
-       <mkdir dir="${TEST_DIR}/data" />\r
-        <copy todir="${TEST_DIR}/data">\r
-               <fileset dir="${BUILD_DIR}/test/data/" />\r
-       </copy>\r
-        <java jar="${JAR}" fork="true">
-            <arg value="${BUILD_DIR}/test/test.js" />
-            <arg value="${JQ}" />
-            <arg value="${TEST_DIR}" />
-        </java>
-        <echo message="Test Suite built." />
-    </target>
-
-    <target name="docs" depends="jquery">
-        <echo message="Building Documentation" />
-        <delete dir="${DOCS_DIR}" />
-        <mkdir dir="${DOCS_DIR}/data" />
-       <copy todir="${DOCS_DIR}" file="${BUILD_DIR}/docs/.htaccess" />
-        <mkdir dir="${DOCS_DIR}/js" />
-        <copy todir="${DOCS_DIR}/js" >
-            <fileset dir="${BUILD_DIR}/docs/js">
-                <include name="**/*.js"/>
-            </fileset>
-        </copy>
-               <copy todir="${DOCS_DIR}/style" >
-            <fileset dir="${BUILD_DIR}/docs/style">
-                <include name="**"/>
-            </fileset>
-        </copy>
-        <java jar="${JAR}" fork="true">
-            <arg value="${BUILD_DIR}/docs/docs.js" />
-            <arg value="${JQ}" />
-            <arg value="${DOCS_DIR}" />
+       <target name="runtest">
+               <echo message="Running Automated Test Suite" />
+               <java jar="${JAR}" fork="true">
+            <arg value="${BUILD_DIR}/runtest/test.js" />
         </java>
-        <echo message="Documentation built." />
-    </target>
+               <echo message="Test Suite Finished" />
+       </target>
 
     <target name="clean">
-        <delete dir="${DOCS_DIR}" />
-        <delete dir="${TEST_DIR}" />
         <delete dir="${DIST_DIR}" />
     </target>
 
-    <target name="all" depends="clean,jquery,lite,min,pack,docs,test" >
+    <target name="all" depends="clean,jquery,min,pack">
         <echo message="Build complete." />
-    </target>\r
-       \r
-       <!-- PLUGINS -->\r
-       \r
-       <target name="ifx" description="Build jquery with Interface fx plugins">\r
-               <antcall target="plugin">\r
-                       <param name="plugins" value="interface/ifx*.js" />\r
-               </antcall>\r
-       </target>\r
-       \r
-       <target name="plugindocs" description="Build documentation for a set of plugins - Not working, yet">\r
-               <antcall target="raw">\r
-                       <param name="plugins" value="center/*.js, cookie/*.js, form/*.js" />\r
-               </antcall>\r
-               <antcall target="docs" />\r
-       </target>\r
-       \r
-       <target name="raw" description="Build a set of plugins, without jquery itself">\r
-               <concat destfile="${JQ}">\r
-                       <fileset dir="${PLUGIN_DIR}" includes="${plugins}" />\r
-        </concat>\r
-               <echo message="${plugins} built." />\r
-       </target>\r
-       \r
-       <target name="plugin" depends="jquery" description="Build jquery with a given set of plugins, see ifx target for an example">\r
-               <copy tofile="${JQ_TEMP}" file="${JQ}"/>\r
-               <concat destfile="${JQ}">\r
-               <fileset file="${JQ_TEMP}" />\r
-                       <fileset dir="${PLUGIN_DIR}" includes="${plugins}" />\r
-        </concat>\r
-               <delete file="${JQ_TEMP}" />\r
-               <echo message="${JQ} with ${plugins} built." />\r
+    </target>
+       
+       <target name="openAjaxMetadata">
+               <property name="target" value="openAjaxMetadata-jquery-${version}.xml" />
+               <delete file="dist/jquery-*.xml" />
+               <get src="http://www.exfer.net/jquery/createjQueryXMLDocs.py?version=1.3" dest="${target}" />
+               <xslt includes="${target}" excludes="build.xml" destdir="./dist" style="build/style.xsl" extension=".xml" />
+               <delete file="${target}" />
        </target>
 
 </project>