Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
Added a coverage target to instrument modules with yuitest code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Aug 3, 2012
1 parent 1c1b873 commit 9f94e2c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion componentbuild/3.x/module.xml
Expand Up @@ -5,7 +5,7 @@
<dirname property="module.basedir" file="${ant.file.YuiModuleTargets}"/>
<import file="${module.basedir}/../shared/targets.xml" description="Targets common to Rollup/Module" />

<target name="build" depends="buildcore, -rollupjs, buildskins, buildlangs" />
<target name="build" depends="buildcore, -rollupjs, buildskins, buildlangs, build-coverage" />
<target name="buildskins" depends="-buildskins, -rollupcss" />
<target name="buildlangs" depends="-buildlangs, -rolluplangs" />

Expand All @@ -27,6 +27,11 @@
flags="${component.logger.regex.flags}" />
</target>

<target name="build-coverage" unless="coverage.skip">
<echo>Creating coverage file for: ${component.builddir}/${component.basefilename}.js</echo>
<yuicoverage src="${component.builddir}/${component.basefilename}.js" dest="${component.builddir}/${component.basefilename}-coverage.js" />
</target>

<!-- DEBUG -->
<target name="builddebug" depends="-concatdebug, -registerdebug, -prependdebug, -appenddebug" description="Create component-debug.js">
<fixcrlf srcdir="${component.builddir}" includes="${component.basefilename}-debug.js" eol="${buildfiles.eol}" />
Expand Down
Binary file not shown.
14 changes: 14 additions & 0 deletions componentbuild/shared/macrolib.xml
Expand Up @@ -95,6 +95,20 @@
</then>
</if>

<macrodef name="yuicoverage">
<attribute name="dest" />
<attribute name="src" />
<sequential>
<java jar="${yuitest-coverage.jar}" failonerror="true" fork="true">
<arg value="--charset" />
<arg value="utf8" />
<arg value="-o" />
<arg path="@{dest}" />
<arg path="@{src}" />
</java>
</sequential>
</macrodef>

<macrodef name="concatsource">
<attribute name="destfile" />
<attribute name="sourcedir" />
Expand Down
1 change: 1 addition & 0 deletions componentbuild/shared/properties.xml
Expand Up @@ -26,6 +26,7 @@
<property name="jslintconsole.js" location="${builddir}/lib/jslint/jslint-console.js" />
<property name="jslintsrc.js" location="${builddir}/lib/jslint/fulljslint.js" />
<property name="yuicompressor.jar" location="${builddir}/lib/yuicompressor/ant-yuicompressor-2.4.5pre2.jar" />
<property name="yuitest-coverage.jar" location="${builddir}/lib/yuitest-coverage/yuitest-coverage.jar" />
<property name="yrb2jsonconsole.js" location="${builddir}/lib/yrb2json/yrb2json-console.js" />
<property name="yrb2jsonsrc.js" location="${builddir}/lib/yrb2json/yrb2json.js" />

Expand Down

0 comments on commit 9f94e2c

Please sign in to comment.