diff jacoco-ant.xml @ 31:0cbc383e341b

TL-34: Handle case of missing coverage data file under sonar
author smith@nwoca.org
date Tue, 12 Apr 2011 16:49:39 -0400
parents ea29594bb799
children 139a3611ae99
line wrap: on
line diff
--- a/jacoco-ant.xml	Mon Apr 11 20:03:18 2011 -0400
+++ b/jacoco-ant.xml	Tue Apr 12 16:49:39 2011 -0400
@@ -43,21 +43,28 @@
             description="Generates an XML converage report."
             depends="-check.jacoco,project.init"
             if="jacoco.installed">
-        <mkdir dir="${jacoco.report.dir}"/>
-        <jacoco:report>
-            <executiondata>
-                <file file="${jacoco.data.file}"/>
-            </executiondata>
-            <structure name="${ivy.project.module}">
-                <classfiles>
-                    <fileset dir="${build.classes.dir}"/>
-                </classfiles>
-                <sourcefiles encoding="UTF-8">
-                    <fileset dir="${src.dir}"/>
-                </sourcefiles>
-            </structure>
-            <xml destfile="${jacoco.report.dir}/jacoco.xml"/>
-        </jacoco:report>
+        <if><available file="${jacoco.data.file}"/>
+            <then>
+                <mkdir dir="${jacoco.report.dir}"/>
+                <jacoco:report>
+                    <executiondata>
+                        <file file="${jacoco.data.file}"/>
+                    </executiondata>
+                    <structure name="${ivy.project.module}">
+                        <classfiles>
+                            <fileset dir="${build.classes.dir}"/>
+                        </classfiles>
+                        <sourcefiles encoding="UTF-8">
+                            <fileset dir="${src.dir}"/>
+                        </sourcefiles>
+                    </structure>
+                    <xml destfile="${jacoco.report.dir}/jacoco.xml"/>
+                </jacoco:report>
+            </then>
+            <else>
+                <echo message="Coverage data not available. coverage.xml skipped"/>
+            </else>
+        </if>
 
     </target>