Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

243 lines (206 sloc) 9.762 kB
<project name="csslint" default="build.all">
<!-- version number -->
<property name="csslint.version" value="0.8.5" />
<!-- the directories containing the source files -->
<property name="src.dir" value="./src" />
<property name="npm.dir" value="./npm" />
<property name="tests.dir" value="./tests" />
<!-- the directories and files to output to -->
<property name="build.dir" value="./build" />
<property name="release.dir" value="./release" />
<property name="build.npm.dir" value="${build.dir}/npm" />
<!-- the directory containing library files -->
<property name="lib.dir" value="./lib" />
<!-- library files -->
<property name="jshint.js" value="jshint.js" />
<property name="parserlib.js" value="parserlib.js" />
<property name="yuitest.js" value="yuitest.js" />
<!-- external resources -->
<property name="parser.url" value="https://raw.github.com/nzakas/parser-lib/master/build/parserlib.js"/>
<!-- output filenames -->
<property name="core.build.file" value="csslint.js"/>
<property name="node.build.file" value="csslint-node.js"/>
<property name="worker.build.file" value="csslint-worker.js"/>
<property name="tests.build.file" value="csslint-tests.js"/>
<property name="rhino.build.file" value="csslint-rhino.js"/>
<property name="wsh.build.file" value="csslint-wsh.js"/>
<!-- embeddable license -->
<loadfile property="license.text" srcfile="LICENSE" />
<!-- get a timestamp -->
<tstamp>
<format property="RIGHT_NOW"
pattern="d-MMMM-yyyy hh:mm:ss"
locale="en,US"/>
</tstamp>
<tstamp>
<format property="SIMPLE_DATE"
pattern="MMMM d, yyyy"
locale="en,US"/>
</tstamp>
<!-- clean -->
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="changelog.update">
<exec executable="git" failonerror="true" outputproperty="git.tag">
<arg line="tag"/>
</exec>
<script language="javascript"><![CDATA[
//get the most recent tag to get the diff
var tags = csslint.getProperty("git.tag").replace("\r", "").split("\n"),
lastTag = tags[tags.length-1];
csslint.setProperty("git.log.range", lastTag + "..HEAD");
]]></script>
<!-- git log -pretty=format:'* %s (%an)' v0.4.0..v0.5.0-->
<exec executable="git" failonerror="true" outputproperty="git.changelog">
<arg line="log --pretty=format:'* %s (%an)' ${git.log.range}"/>
</exec>
<concat destfile="CHANGELOG.tmp" fixlastline="true">
<header trimleading="yes">${SIMPLE_DATE} - v${csslint.version}
${git.changelog}
</header>
<fileset dir="." includes="CHANGELOG" />
</concat>
<delete file="CHANGELOG"/>
<move file="CHANGELOG.tmp" tofile="CHANGELOG"/>
</target>
<!-- validate JS files with JSHint -->
<target name="lint">
<fileset dir="${src.dir}" includes="**/*.js" id="jsfiles.raw"/>
<pathconvert pathsep=" " property="jsfiles.clean" refid="jsfiles.raw" />
<exec executable="java" failonerror="true">
<arg line="-jar"/>
<arg path="${lib.dir}/js.jar"/>
<arg path="${lib.dir}/jshint.js" />
<arg line="${jsfiles.clean} curly=true,forin=true,latedef=true,noempty=true,undef=true,rhino=false" />
</exec>
</target>
<!-- run tests on the command line -->
<target name="test" depends="build.all,lint,test.general.rules">
<exec executable="java" failonerror="true">
<arg line="-jar"/>
<arg path="${lib.dir}/js.jar"/>
<arg path="${lib.dir}/yuitest-rhino-cli.js" />
<arg path="${build.dir}/${core.build.file}" />
<arg path="${build.dir}/${tests.build.file}" />
</exec>
</target>
<!-- must be done separately from other tests due to Rhino limitations -->
<target name="test.general.rules">
<exec executable="java" failonerror="true">
<arg line="-jar"/>
<arg path="${lib.dir}/js.jar"/>
<arg path="${lib.dir}/yuitest-rhino-cli.js" />
<arg path="${build.dir}/${core.build.file}" />
<arg path="${tests.dir}/all-rules.js" />
</exec>
</target>
<!-- build the core library -->
<target name="build.core">
<concat destfile="${build.dir}/${core.build.file}" fixlastline="true">
<header trimleading="yes">/*!
${license.text}
*/
/* Build time: ${RIGHT_NOW} */
var CSSLint = (function(){
</header>
<fileset dir="${lib.dir}" includes="${parserlib.js}" />
<filelist dir="${src.dir}/core" files="CSSLint.js" />
<fileset dir="${src.dir}/core" includes="*.js" excludes="CSSLint.js"/>
<fileset dir="${src.dir}/rules" includes="*.js" />
<fileset dir="${src.dir}/formatters" includes="*.js" />
<footer trimleading="yes">
return CSSLint;
})();
</footer>
</concat>
</target>
<!-- build the web worker library -->
<target name="build.worker">
<concat destfile="${build.dir}/${worker.build.file}" fixlastline="true">
<header trimleading="yes">/*!
${license.text}
*/
/* Build time: ${RIGHT_NOW} */
</header>
<fileset dir="${lib.dir}" includes="${parserlib.js}" />
<filelist dir="${src.dir}/core" files="CSSLint.js" />
<fileset dir="${src.dir}/core" includes="*.js" excludes="CSSLint.js"/>
<fileset dir="${src.dir}/rules" includes="*.js" />
<fileset dir="${src.dir}/formatters" includes="*.js" />
<fileset dir="${src.dir}/worker" includes="*.js" />
</concat>
</target>
<!-- build the Node.js package -->
<target name="build.node">
<concat destfile="${build.dir}/${node.build.file}" fixlastline="true">
<header trimleading="yes">/*!
${license.text}
*/
/* Build time: ${RIGHT_NOW} */
</header>
<fileset dir="${lib.dir}" includes="${parserlib.js}" />
<filelist dir="${src.dir}/core" files="CSSLint.js" />
<fileset dir="${src.dir}/core" includes="*.js" excludes="CSSLint.js"/>
<fileset dir="${src.dir}/rules" includes="*.js" />
<fileset dir="${src.dir}/formatters" includes="*.js" />
<footer trimleading="yes">
exports.CSSLint = CSSLint;
</footer>
</concat>
<mkdir dir="${build.npm.dir}"/>
<mkdir dir="${build.npm.dir}/lib"/>
<copy file="${npm.dir}/package.json" todir="${build.npm.dir}"/>
<concat destfile="${build.npm.dir}/cli.js" fixlastline="true">
<header trimleading="yes">#!/usr/bin/env node
/* Build time: ${RIGHT_NOW} */
</header>
<filelist dir="${src.dir}/cli" files="common.js,node.js" />
</concat>
<copy file="${build.dir}/${node.build.file}" todir="${build.npm.dir}/lib"/>
<!-- CRLF will cause Node version to break -->
<fixcrlf srcdir="${build.dir}" includes="**/*" eol="lf" />
</target>
<!-- build the tests into a single file -->
<target name="build.tests">
<concat destfile="${build.dir}/${tests.build.file}" fixlastline="true">
<fileset dir="${tests.dir}/" includes="**/*.js" excludes="all-rules.js" />
</concat>
</target>
<!-- build for rhino CLI integration -->
<target name="build.rhino" depends="build.core">
<concat destfile="${build.dir}/${rhino.build.file}" fixlastline="true">
<filelist dir="${build.dir}" files="${core.build.file}" />
<filelist dir="${src.dir}/cli" files="common.js,rhino.js" />
</concat>
</target>
<!-- build for WSH CLI integration -->
<target name="build.wsh" depends="build.core">
<concat destfile="${build.dir}/${wsh.build.file}" fixlastline="true">
<filelist dir="${build.dir}" files="${core.build.file}" />
<filelist dir="${src.dir}/cli" files="common.js,wsh.js" />
</concat>
</target>
<!-- Create a release with version number embedded -->
<target name="release" depends="test,build.all,changelog.update">
<delete dir="${release.dir}" />
<mkdir dir="${release.dir}"/>
<copy todir="${release.dir}">
<fileset dir="${build.dir}" includes="**/*" />
</copy>
<replaceregexp match="@VERSION@" replace="${csslint.version}" flags="g" byline="true">
<fileset dir="${release.dir}" includes="**/*"/>
</replaceregexp>
</target>
<!-- Update CSS parser with the latest -->
<target name="parser.update">
<get src="${parser.url}" dest="${lib.dir}/${parserlib.js}" />
</target>
<!-- Update JSHint with the latest -->
<target name="jshint.update">
<get src="${jshint-rhino.url}" dest="${lib.dir}/" />
<get src="${jshint.url}" dest="${lib.dir}/" />
</target>
<!-- Build all files -->
<target name="build.all" depends="clean,build.core,build.worker,build.node,build.tests,build.rhino,build.wsh"/>
</project>
Jump to Line
Something went wrong with that request. Please try again.