Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
231 lines (183 sloc) 7.63 KB
<?xml version="1.0" encoding="UTF-8"?>
<project name="glow" default="all" basedir=".">
<!-- PROPERTIES -->
<property file="build.properties" />
<property name="NAME" value="glow" />
<property name="ROOT_DIR" value="." />
<property name="INCLUDE_DIR" value="${ROOT_DIR}/src/include/" />
<property name="BUILD_DIR" value="${ROOT_DIR}/build/" />
<property name="BUILDSRC_DIR" value="${BUILD_DIR}${VERSION}/" />
<property name="BUILDLIB_DIR" value="${BUILD_DIR}lib/" />
<property name="DIST_DIR" value="${ROOT_DIR}/dist/" />
<property name="DISTSRC_DIR" value="${DIST_DIR}/${NAME}/${VERSION}" />
<property name="DIST_ZIP" value="${ROOT_DIR}/${NAME}-${VERSION}.zip" />
<property name="DIST_TGZ" value="${ROOT_DIR}/${NAME}-${VERSION}.tgz" />
<property name="DOCS_DIR" value="${DIST_DIR}/docs/" />
<property name="SIZZLE_DIR" value="${ROOT_DIR}/src/NodeList/_sizzle/sizzle/" />
<property name="QUNIT_DIR" value="${ROOT_DIR}/test/unit/lib/qunit/" />
<property name="WOOSH_DIR" value="${ROOT_DIR}/test/speed/lib/woosh/" />
<property name="JSDOC_DIR" value="${BUILDLIB_DIR}/jsdoc-toolkit/" />
<property name="YUI_DIR" value="${BUILDLIB_DIR}/yuicompressor/" />
<property name="YUI_JAR" value="${YUI_DIR}build/yuicompressor-2.4.2.jar" />
<loadfile property="SIZZLE-EXPORTS" srcfile="${ROOT_DIR}/src/NodeList/_sizzle/sizzle-glow.js" />
<xmlproperty file="packages/packages.xml" collapseAttributes="true" />
<!-- TARGETS -->
<target name="deps">
<echo message="Setting up external dependencies" />
<tempfile property="temp.zip" suffix=".zip" deleteonexit="yes" />
<delete dir="${JSDOC_DIR}" />
<mkdir dir="${JSDOC_DIR}" />
<get dest="${temp.zip}" src="${JSDOC_URL}" />
<unzip dest="${JSDOC_DIR}" src="${temp.zip}">
<regexpmapper from="^[^\/]*\/[^\/]*\/(.*)" to="\1"/>
</unzip>
<delete dir="${YUI_DIR}" />
<mkdir dir="${YUI_DIR}" />
<get dest="${temp.zip}" src="${YUICOMPRESSOR_URL}" />
<unzip dest="${YUI_DIR}" src="${temp.zip}">
<regexpmapper from="^[^\/]*\/(.*)" to="\1"/>
</unzip>
<delete dir="${SIZZLE_DIR}" />
<mkdir dir="${SIZZLE_DIR}" />
<get dest="${temp.zip}" src="${SIZZLE_URL}" />
<untar dest="${SIZZLE_DIR}" src="${temp.zip}" compression="gzip">
<regexpmapper from="^[^\/]*\/(.*)" to="\1"/>
</untar>
<replaceregexp match="// EXPOSE" replace="${SIZZLE-EXPORTS}" file="${SIZZLE_DIR}/sizzle.js" />
<delete dir="${QUNIT_DIR}" />
<mkdir dir="${QUNIT_DIR}" />
<get dest="${temp.zip}" src="${QUNIT_URL}" />
<untar dest="${QUNIT_DIR}" src="${temp.zip}" compression="gzip">
<regexpmapper from="^[^\/]*\/(.*)" to="\1"/>
</untar>
<delete dir="${WOOSH_DIR}" />
<mkdir dir="${WOOSH_DIR}" />
<get dest="${temp.zip}" src="${WOOSH_URL}" />
<untar dest="${WOOSH_DIR}" src="${temp.zip}" compression="gzip">
<regexpmapper from="^[^\/]*\/(.*)" to="\1"/>
</untar>
</target>
<target name="clean">
<echo message="Deleting previously built files &amp; directories" />
<delete file="${BUILD_DIR}/meta.js" />
<delete file="${DIST_ZIP}" />
<delete file="${DIST_TGZ}" />
<delete dir="${BUILDSRC_DIR}" />
<delete dir="${DOCS_DIR}" />
<delete dir="${DIST_DIR}" />
</target>
<target name="setup">
<echo message="Setting up necessary directories" />
<mkdir dir="${BUILDSRC_DIR}" />
<mkdir dir="${DOCS_DIR}" />
<mkdir dir="${DIST_DIR}" />
</target>
<target name="meta" depends="setup">
<echo message="Creating meta file" />
<tstamp>
<format property="BUILT_DATE" pattern="d MMMM yyyy hh:mm aa" offset="0" unit="hour" locale="en,UK" />
</tstamp>
<echo file="${BUILD_DIR}/meta.js" append="false">
meta({ version: '${VERSION}', buildDate: '${BUILT_DATE}' });
</echo>
</target>
<target name="knit" depends="meta">
<echo message="Combining files to build packages" />
<concat destfile="${BUILDSRC_DIR}/glow.js" fixlastline="yes" eol="lf">
<filelist dir="${ROOT_DIR}" files="${packages.glow.js.file}" />
</concat>
<concat destfile="${BUILDSRC_DIR}/core.js" fixlastline="yes" eol="lf">
<filelist dir="${ROOT_DIR}" files="${packages.core.js.file}" />
</concat>
<concat destfile="${BUILDSRC_DIR}/ui.js" fixlastline="yes" eol="lf">
<filelist dir="${ROOT_DIR}" files="${packages.ui.js.file}" />
</concat>
<concat destfile="${BUILDSRC_DIR}/ui.css" fixlastline="yes" eol="lf">
<filelist dir="${ROOT_DIR}" files="${packages.ui.css.file}" />
</concat>
</target>
<target name="filter" depends="knit">
<echo message="Adding includes to source" />
<loadfile property="include.glowbug.js" srcfile="${INCLUDE_DIR}glowbug.js"/>
<replace dir="${BUILDSRC_DIR}" includes="**/*.js">
<replacefilter token="/*!include:glowbug.js*/" value="${include.glowbug.js}" />
</replace>
<echo message="Adding real version number to source"/>
<replace dir="${BUILDSRC_DIR}" includes="**/*.js,**/*.css">
<replacefilter token="@SRC@" value="${VERSION}" />
<replacefilter token="CSSVERSION" value="${CSSVERSION}" />
</replace>
</target>
<target name="copyimgs" depends="clean,setup">
<copy todir="${BUILDSRC_DIR}/images">
<fileset dir="src" includes="**/images/**" />
<regexpmapper from="/images/(.*)$" to="\1" handledirsep="true" />
</copy>
</target>
<target name="apidocs" depends="filter">
<echo message="Generating API documentation from JsDoc: ${JSDOC_DIR}" />
<exec executable="java" failonerror="true">
<arg value="-jar"/>
<arg value="${JSDOC_DIR}jsrun.jar"/>
<arg value="${JSDOC_DIR}app/run.js" />
<arg value="-n" />
<arg value="-v" />
<arg value="-u" />
<arg value="-t=${JSDOC_DIR}templates/jsdoc/" />
<arg value="-d=${DOCS_DIR}/" />
<arg value="-r=1" />
<arg value="${BUILDSRC_DIR}" />
</exec>
</target>
<target name="debug" depends="filter">
<echo message="Creating debug version" />
<copy todir="${BUILDSRC_DIR}">
<fileset dir="${BUILDSRC_DIR}">
<include name="**/*.js" />
<include name="**/*.css" />
</fileset>
<mapper type="regexp" from="(.*)\.(js|css)" to="\1.debug.\2"/>
</copy>
</target>
<target name="minify" depends="filter">
<echo message="Removing debugging code" />
<replaceregexp match="/\*!debug\*/.*?/\*gubed!\*/" flags="gs" replace="">
<fileset dir="${BUILDSRC_DIR}" includes="**/*.js,**/*.css" excludes="**/*.debug.*" />
</replaceregexp>
<echo message="Creating minified files" />
<apply executable="java" parallel="false" failonerror="true">
<arg line="-jar"/>
<arg path="${YUI_JAR}"/>
<arg value="--preserve-semi" />
<srcfile/>
<fileset dir="${BUILDSRC_DIR}" includes="**/*.js,**/*.css" excludes="**/*.debug.*" />
<redirector>
<outputmapper type="glob" from="*" to="${BUILDSRC_DIR}/*" />
</redirector>
</apply>
</target>
<target name="dist" depends="minify">
<echo message="Copying project information files to dist folder" />
<copy todir="${DIST_DIR}" >
<fileset dir="${ROOT_DIR}" includes="CONTRIBUTORS,LICENCE,README,CHANGES" />
</copy>
<echo message="Copying files to dist folder" />
<copy todir="${DISTSRC_DIR}" >
<fileset dir="${BUILDSRC_DIR}" />
</copy>
<echo message="Creating distribution zip &amp; tar.gz files" />
<zip destfile="${DIST_ZIP}">
<fileset dir="${DIST_DIR}"/>
</zip>
<tar destfile="${DIST_TGZ}" compression="gzip">
<zipfileset src="${DIST_ZIP}"/>
</tar>
</target>
<target name="all" depends="clean, setup, meta, knit, copyimgs, filter, apidocs, debug, minify, dist">
<echo message="" />
<echo message="**************************************" />
<echo message="Glow version ${VERSION} build complete" />
<echo message="**************************************" />
<echo message="" />
</target>
</project>
Something went wrong with that request. Please try again.