Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tag: v0.1.0
Fetching contributors…

Cannot retrieve contributors at this time

240 lines (210 sloc) 9.422 kB
<project name="parserlib" default="build.all">
<!-- version number -->
<property name="parserlib.version" value="0.1.0" />
<!-- the directories containing the source files -->
<property name="src.dir" value="./src" />
<property name="tests.dir" value="./tests" />
<!-- the directories and files to output to -->
<property name="lib.dir" value="./lib" />
<!-- the directories and files to output to -->
<property name="build.dir" value="./build" />
<property name="release.dir" value="./release" />
<!-- output filenames -->
<property name="full.build.file" value="parserlib.js"/>
<property name="core.build.file" value="parserlib-core.js"/>
<property name="css.build.file" value="parserlib-css.js"/>
<property name="tests.build.file" value="parserlib-tests.js"/>
<property name="node.build.file" value="node-parserlib.js"/>
<!-- license information -->
<loadfile property="license.text" srcfile="LICENSE" />
<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 = parserlib.getProperty("git.tag").replace("\r", "").split("\n"),
lastTag = tags[tags.length-1];
parserlib.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${parserlib.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,evil=true,loopfunc=true,undef=true,rhino=false" />
</exec>
</target>
<!-- run tests on the command line -->
<target name="test" depends="lint,build.all">
<apply executable="java" failonerror="true">
<fileset dir="${tests.dir}" includes="**/*.js"/>
<arg line="-jar"/>
<arg path="${lib.dir}/js.jar"/>
<arg path="${lib.dir}/yuitest-rhino-cli.js" />
<arg path="${build.dir}/${full.build.file}" />
<srcfile/>
</apply>
</target>
<!-- build the full library -->
<target name="build.full" depends="build.core,build.css">
<concat destfile="${build.dir}/${full.build.file}" fixlastline="true">
<filelist dir="${build.dir}" files="${core.build.file}, ${css.build.file}"/>
</concat>
</target>
<!-- build the core library -->
<target name="build.core">
<concat destfile="${build.dir}/${core.build.file}" fixlastline="true">
<header trimleading="yes">/*!
${license.text}
*/
/* Version v@VERSION@, Build time: ${RIGHT_NOW} */
var parserlib = {};
(function(){
</header>
<!--<filelist dir="${src.dir}/util" files="EventTarget.js, StringReader.js, TokenStream.js"/> -->
<fileset dir="${src.dir}/util" includes="*.js" />
<footer trimleading="yes">
parserlib.util = {
StringReader: StringReader,
SyntaxError : SyntaxError,
SyntaxUnit : SyntaxUnit,
EventTarget : EventTarget,
TokenStreamBase : TokenStreamBase
};
})();
</footer>
</concat>
</target>
<!-- build the CSS library -->
<target name="build.css">
<concat destfile="${build.dir}/${css.build.file}" fixlastline="true">
<header trimleading="yes">/*
${license.text}
*/
/* Version v@VERSION@, Build time: ${RIGHT_NOW} */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
StringReader = parserlib.util.StringReader,
SyntaxError = parserlib.util.SyntaxError,
SyntaxUnit = parserlib.util.SyntaxUnit;
</header>
<!--<filelist dir="${src.dir}/css" files="CSSTokens.js, CSSSelectorUnit.js, CSSColors.js, CSSValueUnit.js, CSSParser.js"/>-->
<fileset dir="${src.dir}/css" includes="*.js" />
<footer trimleading="yes">
parserlib.css = {
Colors :Colors,
Combinator :Combinator,
Parser :Parser,
PropertyName :PropertyName,
PropertyValue :PropertyValue,
PropertyValuePart :PropertyValuePart,
MediaFeature :MediaFeature,
MediaQuery :MediaQuery,
Selector :Selector,
SelectorPart :SelectorPart,
SelectorSubPart :SelectorSubPart,
Specificity :Specificity,
TokenStream :TokenStream,
Tokens :Tokens,
ValidationError :ValidationError
};
})();
</footer>
</concat>
</target>
<!-- Build the Node version -->
<target name="build.node">
<!--<concat destfile="${build.dir}/${node.build.file}" fixlastline="true">
<header trimleading="yes">/*
${license.text}
*/
</header>
<fileset dir="${src.dir}/util" includes="*.js" />
<fileset dir="${src.dir}/css" includes="*.js" />
<footer trimleading="yes">
exports.util = {
StringReader: StringReader,
SyntaxError : SyntaxError,
SyntaxUnit : SyntaxUnit,
EventTarget : EventTarget,
TokenStreamBase : TokenStreamBase
};
exports.css = {
Colors :Colors,
Combinator :Combinator,
Parser :Parser,
PropertyName :PropertyName,
PropertyValue :PropertyValue,
MediaFeature :MediaFeature,
MediaQuery :MediaQuery,
Selector :Selector,
SelectorPart :SelectorPart,
SelectorSubPart :SelectorSubPart,
TokenStream :TokenStream,
Tokens :Tokens
};
</footer>
</concat>-->
<concat destfile="${build.dir}/${node.build.file}" fixlastline="true">
<filelist dir="${build.dir}" files="${core.build.file}, ${css.build.file}"/>
<footer trimleading="yes">
(function(){
for(var prop in parserlib){
exports[prop] = parserlib[prop];
}
})();
</footer>
</concat>
</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" />
</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="${parserlib.version}" flags="g" byline="true">
<fileset dir="${release.dir}" includes="**/*"/>
</replaceregexp>
</target>
<!-- Build all files -->
<target name="build.all" depends="build.full,build.node,build.tests"/>
</project>
Jump to Line
Something went wrong with that request. Please try again.