| 1 | <project name="jQuery" default="jquery" basedir="."> |
|---|
| 2 | |
|---|
| 3 | <!-- |
|---|
| 4 | To get jQuery even smaller, remove the modules you don't need by removing the fileset elements |
|---|
| 5 | in the jquery-target, for example leaving only these: |
|---|
| 6 | |
|---|
| 7 | <fileset dir="${SRC_DIR}" includes="intro.js" /> |
|---|
| 8 | <fileset dir="${SRC_DIR}" includes="core.js" /> |
|---|
| 9 | <fileset dir="${SRC_DIR}" includes="selector.js" /> |
|---|
| 10 | <fileset dir="${SRC_DIR}" includes="event.js" /> |
|---|
| 11 | <fileset dir="${SRC_DIR}" includes="outro.js" /> |
|---|
| 12 | |
|---|
| 13 | That'd remove ajax, fx and offset support, leaving basic selectors, manipulation and event handling. |
|---|
| 14 | --> |
|---|
| 15 | |
|---|
| 16 | <!-- SETUP --> |
|---|
| 17 | |
|---|
| 18 | <property description="Source Folder" name="SRC_DIR" value="src" /> |
|---|
| 19 | <property description="Files for parsing etc." name="BUILD_DIR" value="build" /> |
|---|
| 20 | <property description="Rhino JS Engine" name="JAR" value="${BUILD_DIR}/js.jar" /> |
|---|
| 21 | |
|---|
| 22 | <property description="Folder for jquery, min, lite and packed target" name="DIST_DIR" value="./dist" /> |
|---|
| 23 | |
|---|
| 24 | <!-- Files names for distribution --> |
|---|
| 25 | <property name="JQ" value="${DIST_DIR}/jquery.js" /> |
|---|
| 26 | <property name="JQ_LITE" value="${DIST_DIR}/jquery.lite.js" /> |
|---|
| 27 | <property name="JQ_MIN" value="${DIST_DIR}/jquery.min.js" /> |
|---|
| 28 | <property name="JQ_PACK" value="${DIST_DIR}/jquery.pack.js" /> |
|---|
| 29 | |
|---|
| 30 | <!-- MAIN --> |
|---|
| 31 | |
|---|
| 32 | <target name="jquery" description="Main jquery build, concatenates source files and replaces @VERSION"> |
|---|
| 33 | <echo message="Building ${JQ}" /> |
|---|
| 34 | <mkdir dir="${DIST_DIR}" /> |
|---|
| 35 | <concat destfile="${JQ}"> |
|---|
| 36 | <fileset dir="${SRC_DIR}" includes="intro.js" /> |
|---|
| 37 | <fileset dir="${SRC_DIR}" includes="core.js" /> |
|---|
| 38 | <fileset dir="${SRC_DIR}" includes="selector.js" /> |
|---|
| 39 | <fileset dir="${SRC_DIR}" includes="event.js" /> |
|---|
| 40 | <fileset dir="${SRC_DIR}" includes="ajax.js" /> |
|---|
| 41 | <fileset dir="${SRC_DIR}" includes="fx.js" /> |
|---|
| 42 | <fileset dir="${SRC_DIR}" includes="offset.js" /> |
|---|
| 43 | <fileset dir="${SRC_DIR}" includes="dimensions.js" /> |
|---|
| 44 | <fileset dir="${SRC_DIR}" includes="outro.js" /> |
|---|
| 45 | </concat> |
|---|
| 46 | <java jar="${JAR}" fork="true"> |
|---|
| 47 | <arg value="${BUILD_DIR}/build/version.js" /> |
|---|
| 48 | <arg value="${JQ}" /> |
|---|
| 49 | </java> |
|---|
| 50 | <echo message="${JQ} built." /> |
|---|
| 51 | </target> |
|---|
| 52 | |
|---|
| 53 | <target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip"> |
|---|
| 54 | <echo message="Building ${JQ_MIN}" /> |
|---|
| 55 | <java jar="${JAR}" fork="true"> |
|---|
| 56 | <arg value="${BUILD_DIR}/build/min.js" /> |
|---|
| 57 | <arg value="${JQ}" /> |
|---|
| 58 | <arg value="${JQ_MIN}" /> |
|---|
| 59 | </java> |
|---|
| 60 | <echo message="${JQ_MIN} built." /> |
|---|
| 61 | </target> |
|---|
| 62 | |
|---|
| 63 | <target name="pack" depends="jquery" description="Remove all comments and whitespace and compress"> |
|---|
| 64 | <echo message="Building ${JQ_PACK}" /> |
|---|
| 65 | <java jar="${JAR}" fork="true"> |
|---|
| 66 | <arg value="${BUILD_DIR}/build/pack.js" /> |
|---|
| 67 | <arg value="${JQ}" /> |
|---|
| 68 | <arg value="${JQ_PACK}" /> |
|---|
| 69 | </java> |
|---|
| 70 | <echo message="${JQ_PACK} built." /> |
|---|
| 71 | </target> |
|---|
| 72 | |
|---|
| 73 | <target name="runtest"> |
|---|
| 74 | <echo message="Running Automated Test Suite" /> |
|---|
| 75 | <java jar="${JAR}" fork="true"> |
|---|
| 76 | <arg value="${BUILD_DIR}/runtest/test.js" /> |
|---|
| 77 | </java> |
|---|
| 78 | <echo message="Test Suite Finished" /> |
|---|
| 79 | </target> |
|---|
| 80 | |
|---|
| 81 | <target name="clean"> |
|---|
| 82 | <delete dir="${DIST_DIR}" /> |
|---|
| 83 | </target> |
|---|
| 84 | |
|---|
| 85 | <target name="all" depends="clean,jquery,min,pack"> |
|---|
| 86 | <echo message="Build complete." /> |
|---|
| 87 | </target> |
|---|
| 88 | |
|---|
| 89 | </project> |
|---|