Author: kkolinko Date: Sun Nov 24 21:04:29 2013 New Revision: 1545076 URL: http://svn.apache.org/r1545076 Log: Merged r1545075 from tomcat/trunk: Do not include Cobertura and instrumented classes into the junit classpath, unless Cobertura is enabled.
This allows to turn Cobertura off and on at any time. This avoids "mkdir ${cobertura.home}" that breaks builds at Apache Gump. Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/build.xml tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1545075 Modified: tomcat/tc7.0.x/trunk/build.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/build.xml?rev=1545076&r1=1545075&r2=1545076&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/build.xml (original) +++ tomcat/tc7.0.x/trunk/build.xml Sun Nov 24 21:04:29 2013 @@ -197,13 +197,6 @@ <path refid="tomcat.classpath" /> </path> - <path id="cobertura.classpath"> - <fileset dir="${cobertura.home}"> - <include name="cobertura-${cobertura.version}.jar" /> - <include name="lib/**/*.jar" /> - </fileset> - </path> - <path id="tomcat.webservices.classpath"> <path refid="tomcat.classpath" /> <fileset dir="${tomcat.extras}/webservices"> @@ -1246,7 +1239,7 @@ <property name="junit.formatter.extension" value=".txt" /> <target name="test" description="Runs the JUnit test cases" - depends="test-init1,test-init2,test-bio,test-nio,test-apr,cobertura-report" > + depends="test-bio,test-nio,test-apr,cobertura-report" > <fail if="test.result.error" message='Some tests completed with an Error. See ${tomcat.build}/logs for details, search for "FAILED".' /> <fail if="test.result.failure" message='Some tests completed with a Failure. See ${tomcat.build}/logs for details, search for "FAILED".' /> </target> @@ -1283,12 +1276,7 @@ <property name="java.bin.path" value=""/> </target> - <target name="test-init" > - <!-- This directory needs to exist even if it is empty otherwise the --> - <!-- use of the cobertura.classpath class path when running the unit --> - <!-- triggers an error. --> - <mkdir dir="${cobertura.home}" /> - </target> + <target name="test-init" depends="test-init1,test-init2" /> <macrodef name="runtests" description="Runs the unit tests using the specified connector. @@ -1299,6 +1287,10 @@ description="The extension to use to distinguish the output"/> <sequential> + <!-- Define classpaths when Cobertura is turned off. --> + <path id="cobertura.classpath" /> + <path id="tomcat.classes.cobertura.classpath" /> + <junit printsummary="yes" fork="yes" dir="." showoutput="yes" errorproperty="test.result.error" failureproperty="test.result.failure" @@ -1311,7 +1303,7 @@ <jvmarg value="-Dapple.awt.UIElement=true"/> <!-- The Cobertura instrumented classes must appear first on the classpath --> - <classpath location="${tomcat.classes.cobertura}" /> + <classpath refid="tomcat.classes.cobertura.classpath" /> <classpath refid="tomcat.test.classpath" /> <classpath refid="cobertura.classpath"/> @@ -1351,6 +1343,18 @@ if="${test.cobertura}" description="Adds Cobertura instrumentation to the compiled bytecode"> + <mkdir dir="${tomcat.classes.cobertura}"/> + + <path id="tomcat.classes.cobertura.classpath" + location="${tomcat.classes.cobertura}" /> + + <path id="cobertura.classpath"> + <fileset dir="${cobertura.home}"> + <include name="cobertura-${cobertura.version}.jar" /> + <include name="lib/**/*.jar" /> + </fileset> + </path> + <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> <cobertura-instrument datafile="${cobertura.datafile}" Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1545076&r1=1545075&r2=1545076&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sun Nov 24 21:04:29 2013 @@ -280,8 +280,9 @@ <subsection name="Other"> <changelog> <add> - Add support for the Cobertura code coverage tool when running the unit - tests. Based on a patch by mhasko. (markt) + <bug>52323</bug>: Add support for the Cobertura code coverage tool + when running the unit tests. Based on a patch by mhasko. + (markt/kkolinko) </add> <update> Update sample Eclipse IDE project. Explicitly use a Java 6 SE JDK. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org