Changeset 1047

Show
Ignore:
Timestamp:
06/27/08 19:04:30 (4 years ago)
Author:
amandel
Message:

Added support for emma coverage report files. The 'es' files are read directly using the emma classes

Location:
trunk
Files:
1 added
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/.classpath

    r919 r1047  
    158158                </attributes> 
    159159        </classpathentry> 
     160        <classpathentry kind="lib" path="lib/default/emma/emma.jar"/> 
    160161        <classpathentry kind="output" path="eclipse/bin"/> 
    161162</classpath> 
  • trunk/CHANGES

    r751 r1047  
    2222  * Generated StrongTypes (immutable ones) do implement a 
    2323    common interface (StrongType). 
     24  * The jcreport can now read emma 'es' files to as coverage 
     25    info. http://emma.sourceforge.net/ 
    2426 
    2527Fawkez 1.1 'The Man Trap' (March 31, 2007) 
    26 https://www.jcoderz.org/fawkez/browser/tags/FAWKEZ_1_1_0 
     28http://www.jcoderz.org/fawkez/browser/tags/FAWKEZ_1_1_0 
    2729 
    2830  * New features: #34 
     
    3335 
    3436Fawkez 1.0 'going public' (November 26, 2006) 
    35 https://www.jcoderz.org/fawkez/browser/tags/FAWKEZ_1_0_0 
     37http://www.jcoderz.org/fawkez/browser/tags/FAWKEZ_1_0_0 
  • trunk/config/ivy.xml

    r1011 r1047  
    140140            <artifact name="avalon-framework" type="jar"/> 
    141141        </dependency> 
     142 
     143        <dependency org="emma" name="emma" rev="2.0.5312"> 
     144            <artifact name="emma" type="jar"/> 
     145            <artifact name="emma_ant" type="jar"/> 
     146        </dependency> 
    142147   </dependencies> 
    143148 
  • trunk/src/java/org/jcoderz/phoenix/report/JcReportAntTask.java

    r1011 r1047  
    402402        } 
    403403 
     404        final File emmaFile; 
     405        if (mTools.getEmma() != null) 
     406        {   // EXCEPTION? 
     407            emmaFile = new File(mTools.getEmma().mDatafile); 
     408        } 
     409        else 
     410        { 
     411            emmaFile = null; 
     412        } 
     413 
    404414        // Merge the different reports into one jcoderz-report.xml 
    405415        // This must be done on a level by level basis 
    406416        return executeReportNormalizer(srcDir, reportTmpDir, 
    407417              nre.getLevel(), checkstyleXml, findbugsXml, pmdXml, 
    408               cpdXml, coberturaXml); 
     418              cpdXml, coberturaXml, emmaFile); 
    409419    } 
    410420 
     
    488498   private File executeReportNormalizer (File srcDir, File reportDir, 
    489499            ReportLevel level, File checkstyleXml, 
    490             File findbugsXml, File pmdXml, File cpdXml, File coberturaXml) 
     500            File findbugsXml, File pmdXml, File cpdXml, File coberturaXml, 
     501            File emmaSummary) 
    491502       throws IOException, JAXBException, TransformerException 
    492503   { 
     
    543554         cmd.createArgument().setValue("-cobertura"); 
    544555         cmd.createArgument().setFile(coberturaXml); 
     556      } 
     557 
     558      if (emmaSummary != null) 
     559      { 
     560         cmd.createArgument().setValue("-emma"); 
     561         cmd.createArgument().setFile(emmaSummary); 
    545562      } 
    546563 
     
    676693   } 
    677694 
    678     
     695 
    679696   // 
    680697   // Reports section 
     
    898915      private NestedCheckstyleElement mCheckstyle = null; 
    899916      private NestedCoberturaElement mCobertura = null; 
     917      private NestedEmmaElement mEmma = null; 
    900918 
    901919      public NestedToolsElement (JcReportAntTask task) 
     
    972990      { 
    973991         return mCobertura; 
     992      } 
     993 
     994      public NestedEmmaElement createEmma () 
     995      { 
     996         mTask.log("Creating Emma element..."); 
     997         mEmma = new NestedEmmaElement(mTask); 
     998         return mEmma; 
     999      } 
     1000 
     1001      public NestedEmmaElement getEmma () 
     1002      { 
     1003         return mEmma; 
    9741004      } 
    9751005   } 
     
    14621492             cmd.getSystemProperties().addVariable(var); 
    14631493         } 
    1464          
     1494 
    14651495         forkToolProcess(mTask, cmd, new LogStreamHandler(mTask, 
    14661496            Project.MSG_INFO, Project.MSG_WARN)); 
     
    15371567   } 
    15381568 
    1539  
     1569   public static class NestedEmmaElement 
     1570        extends NestedToolElement 
     1571    { 
     1572        private String mDatafile; 
     1573 
     1574        public NestedEmmaElement (JcReportAntTask task) 
     1575        { 
     1576            super(task); 
     1577        } 
     1578 
     1579        public void setDatafile (String datafile) 
     1580        { 
     1581            mDatafile = datafile; 
     1582        } 
     1583 
     1584        /** 
     1585         * Nothing to be done for emma. 
     1586         */ 
     1587        public File execute (File reportDir, File srcDir, File clsPath) 
     1588        { 
     1589            return new File(mDatafile); 
     1590        } 
     1591    } 
    15401592   // 
    15411593   // Filters section 
  • trunk/src/java/org/jcoderz/phoenix/report/ReportNormalizer.java

    r627 r1047  
    339339                    addReport(ReportFormat.PMD, args[i + 1]); 
    340340                } 
     341                else if (args[i].equals("-emma")) 
     342                { 
     343                    addReport(ReportFormat.EMMA, args[i + 1]); 
     344                } 
    341345                else if (args[i].equals("-cpd")) 
    342346                { 
  • trunk/src/java/org/jcoderz/phoenix/report/ReportNormalizerAntTask.java

    r107 r1047  
    8181   /** The Java Commandline */ 
    8282   private final CommandlineJava mCommandline = new CommandlineJava(); 
    83    /**  
    84     * List of source directories of type JcoderzReportAntTask.SourceDirectory.  
     83   /** 
     84    * List of source directories of type JcoderzReportAntTask.SourceDirectory. 
    8585    */ 
    8686   private final List mSourceDirectories = new ArrayList(); 
     
    273273      cmd.setClassname(ReportNormalizer.class.getName()); 
    274274 
    275       cmd.createVmArgument().setValue("-Xmx1500m"); 
     275// WOW      cmd.createVmArgument().setValue("-Xmx1500m"); 
    276276 
    277277      cmd.createArgument().setValue("-out"); 
  • trunk/src/java/org/jcoderz/phoenix/report/ReportReaderFactory.java

    r1 r1047  
    3737/** 
    3838 * Factory class to create a report reader for the requested report format. 
    39  *  
     39 * 
    4040 * @author Michael Griffel 
    4141 */ 
     
    5050    /** 
    5151     * Creates a report reader for the given report format. 
    52      *  
     52     * 
    5353     * @param format the report format. 
    5454     * @return a report reader for the given report format. 
     
    8787                result = new SourceDirectoryReader(); 
    8888            } 
     89            else if (ReportFormat.EMMA == format) 
     90            { 
     91                result = new EmmaReportReader(); 
     92            } 
    8993            else if (ReportFormat.JCODERZ == format) 
    9094            { 
  • trunk/src/java/org/jcoderz/phoenix/report/ResourceInfo.java

    r627 r1047  
    149149 
    150150    /** 
     151     * Searches the resource with the given class name and package. 
     152     * 
     153     * @param packageName resource package name. 
     154     * @param className resource class name. 
     155     * @return the resource for the given name or <tt>null</tt> if not found. 
     156     */ 
     157    public static ResourceInfo lookup (String packageName, String className) 
     158    { 
     159        ResourceInfo result = null; 
     160        for (ResourceInfo resource: RESOURCES.values()) 
     161        { 
     162            if (resource.getClassname().equals(className) 
     163                && resource.getPackage().equals(packageName)) 
     164            { 
     165                result = resource; 
     166                break; 
     167            } 
     168        } 
     169        return result; 
     170    } 
     171 
     172    static String dump () 
     173    { 
     174        return RESOURCES.toString(); 
     175    } 
     176    /** 
    151177     * Returns the number of lines for the given file <tt>filename</tt>. 
    152178     * @param fileName the name of the file. 
     
    270296    { 
    271297        return "[ResourceInfo: name=" + mResourceName + ", pkg=" + mPackage 
    272                 + ", sourceDir=" + mSourcDir + "]"; 
     298                + ", sourceDir=" + mSourcDir + ", mClassname=" + mClassname 
     299                + "]"; 
    273300    } 
    274301 
  • trunk/src/java/org/jcoderz/phoenix/report/package.html

    r820 r1047  
    11<body> 
    2 <p>The JCReport performs the following steps: 
     2 
     3The JCReport performs the following steps: 
    34 
    45<ol> 
     
    89<li>Converting the report into a HTML representation.</li> 
    910</ol> 
    10 </p> 
    1111</body>