Author: kkolinko
Date: Tue Nov 26 22:04:35 2013
New Revision: 1545863

URL: http://svn.apache.org/r1545863
Log:
Fix Cobertura runs that were broken by r1545075
I do not know what exactly went wrong, but I suspect that re-declaring a <path> 
with the same id was overwriting the previous definition. Thus I moved those 
into separate <target> that executes conditionally.

Modified:
    tomcat/trunk/build.xml

Modified: tomcat/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1545863&r1=1545862&r2=1545863&view=diff
==============================================================================
--- tomcat/trunk/build.xml (original)
+++ tomcat/trunk/build.xml Tue Nov 26 22:04:35 2013
@@ -1306,10 +1306,6 @@
                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"
@@ -1321,10 +1317,7 @@
         <jvmarg 
value="-Djava.net.preferIPv4Stack=${java.net.preferIPv4Stack}"/>
         <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 refid="tomcat.classes.cobertura.classpath" />
-        <classpath refid="tomcat.test.classpath" />
-        <classpath refid="cobertura.classpath"/>
+        <classpath refid="tomcat.test.run.classpath" />
 
         <sysproperty key="tomcat.test.temp" value="${test.temp}" />
         <sysproperty key="tomcat.test.tomcatbuild" value="${tomcat.build}" />
@@ -1353,15 +1346,17 @@
     </sequential>
   </macrodef>
 
-  <target name="cobertura-instrument" depends="compile,download-cobertura"
+  <target name="cobertura-disabled" unless="${test.cobertura}">
+    <!-- Define classpath used to run tests when Cobertura is turned off. -->
+    <path id="tomcat.test.run.classpath">
+      <path refid="tomcat.test.classpath" />
+    </path>
+  </target>
+
+  <target name="cobertura-instrument" 
depends="compile,download-cobertura,cobertura-disabled"
           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" />
@@ -1392,6 +1387,13 @@
       <auxClasspath path="${jdt.jar}" />
     </cobertura-instrument>
 
+    <!-- Define classpath used to run tests -->
+    <!-- The Cobertura instrumented classes must appear first on the classpath 
-->
+    <path id="tomcat.test.run.classpath">
+      <path location="${tomcat.classes.cobertura}" />
+      <path refid="tomcat.test.classpath" />
+      <path refid="cobertura.classpath"/>
+    </path>
   </target>
 
   <target name="cobertura-report" if="${test.cobertura}"



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to