views:

395

answers:

1

Hello,

I have a problem with Ant and Emma a code coverage plugin, it makes report, but without source code.

I got following code in my build.xml

init emma

    <taskdef resource="emma_ant.properties" />   
    <path id="run.classpath">  
       <pathelement location="${instr}" />  
       <path  refid="build.classpath"/>  
       <pathelement path="${ant.home}/lib/junit-4.5.jar"/>  
       <pathelement path="${ant.home}/lib/emma.jar"/>  
    </path>

making instr

    <target name="instr" depends="compile">  
     <emma>  
       <instr instrpathref="build.classpath"  
        destdir="${instr}"
        metadatafile="${coverage}/metadata.emma"  
        merge="true"  
       />  
     </emma>  
    </target>

setting properties

    <jvmarg value="-Demma.coverage.out.file=${coverage}/coverage.emma" />  
    <jvmarg value="-Demma.coverage.out.merge=true" />

making report

    <emma>  
     <report sourcepath="${src}" >  
      <fileset dir="${coverage}" >  
       <include name="*.emma" />  
      </fileset>  

         <html outfile="${coverage}/coverage.html"/>    
     </report>    
    </emma>

This works nice. It outputs to console:

 [report] processing input files ...
 [report] 2 file(s) read and merged in 10 ms
 [report] not all instrumented classes were compiled with source file
 [report] debug data: no sources will be embedded in the report.
 [report] line coverage requested in a report of type [html] but
 [report] not all instrumented classes were compiled with line number
 [report] debug data: this column will be removed from the report.
 [report] showing up to 3 classes without full debug info per package:
 [report]   ...
 [report] writing [html] report to [C:\...] ...

I want see my source code in report, how can I fix it? I studied documentation of emma and unfortunately there isn't anything related to this problem.

Thank you for answers.

+5  A: 

Ok, I solved a problem.

I added debug="true" to javac and it works now.

Tomáš Linhart
+1 for solving your own problem. I was just about to suggest that.
Mark