Author: kkolinko Date: Sun Nov 24 20:44:07 2013 New Revision: 1545075 URL: http://svn.apache.org/r1545075 Log: 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/trunk/build.xml Modified: tomcat/trunk/build.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1545075&r1=1545074&r2=1545075&view=diff ============================================================================== --- tomcat/trunk/build.xml (original) +++ tomcat/trunk/build.xml Sun Nov 24 20:44:07 2013 @@ -203,13 +203,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"> @@ -1281,19 +1274,19 @@ </target> <target name="test-bio" description="Runs the JUnit test cases for BIO. Does not stop on errors." - depends="test-init,test-compile,deploy,cobertura-instrument" if="${execute.test.bio}"> + depends="test-compile,deploy,cobertura-instrument" if="${execute.test.bio}"> <runtests protocol="org.apache.coyote.http11.Http11Protocol" extension=".BIO" /> </target> <target name="test-nio" description="Runs the JUnit test cases for NIO. Does not stop on errors." - depends="test-init,test-compile,deploy,cobertura-instrument" if="${execute.test.nio}"> + depends="test-compile,deploy,cobertura-instrument" if="${execute.test.nio}"> <runtests protocol="org.apache.coyote.http11.Http11NioProtocol" extension=".NIO" /> </target> <target name="test-apr" description="Runs the JUnit test cases for APR. Does not stop on errors." - depends="test-init,test-compile,deploy,test-apr-exists,cobertura-instrument" + depends="test-compile,deploy,test-apr-exists,cobertura-instrument" if="${apr.exists}"> <runtests protocol="org.apache.coyote.http11.Http11AprProtocol" extension=".APR" /> @@ -1304,13 +1297,6 @@ <available file="${test.apr.loc}" property="apr.exists" /> </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> - <macrodef name="runtests" description="Runs the unit tests using the specified connector. Does not stop on errors, but sets 'test.result.error' and 'test.result.failure' properties."> @@ -1320,6 +1306,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" @@ -1332,7 +1322,7 @@ <jvmarg value="-Dorg.apache.tomcat.util.net.NioSelectorShared=${org.apache.tomcat.util.net.NioSelectorShared}"/> <!-- 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"/> @@ -1367,6 +1357,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}" --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org