Class ReportSupport


  • final class ReportSupport
    extends java.lang.Object
    Encapsulates the tasks to create reports for Maven projects. Instances are supposed to be used in the following sequence:
    1. Create an instance
    2. Load one or multiple exec files with loadExecutionData()
    3. Add one or multiple formatters with addXXX() methods
    4. Create the root visitor with initRootVisitor()
    5. Process one or multiple projects with processProject()
    • Constructor Summary

      Constructors 
      Constructor Description
      ReportSupport​(org.apache.maven.plugin.logging.Log log)
      Construct a new instance with the given log output.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAllFormatters​(java.io.File targetdir, java.lang.String encoding, java.lang.String footer, java.util.Locale locale)  
      void addCsvFormatter​(java.io.File targetfile, java.lang.String encoding)  
      void addHtmlFormatter​(java.io.File targetdir, java.lang.String encoding, java.lang.String footer, java.util.Locale locale)  
      void addRulesChecker​(java.util.List<Rule> rules, IViolationsOutput output)  
      void addXmlFormatter​(java.io.File targetfile, java.lang.String encoding)  
      private static java.util.List<java.io.File> getCompileSourceRoots​(org.apache.maven.project.MavenProject project)  
      IReportVisitor initRootVisitor()  
      void loadExecutionData​(java.io.File execFile)
      Loads the given execution data file.
      private void logBundleInfo​(IBundleCoverage bundle, java.util.Collection<IClassCoverage> nomatch)  
      void processProject​(IReportGroupVisitor visitor, java.lang.String bundeName, org.apache.maven.project.MavenProject project, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes, java.lang.String srcEncoding)
      Calculates coverage for the given project and emits it to the report group including source references
      private void processProject​(IReportGroupVisitor visitor, java.lang.String bundeName, org.apache.maven.project.MavenProject project, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes, ISourceFileLocator locator)  
      void processProject​(IReportGroupVisitor visitor, org.apache.maven.project.MavenProject project, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes)
      Calculates coverage for the given project and emits it to the report group without source references
      private static java.io.File resolvePath​(org.apache.maven.project.MavenProject project, java.lang.String path)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        private final org.apache.maven.plugin.logging.Log log
    • Constructor Detail

      • ReportSupport

        public ReportSupport​(org.apache.maven.plugin.logging.Log log)
        Construct a new instance with the given log output.
        Parameters:
        log - for log output
    • Method Detail

      • loadExecutionData

        public void loadExecutionData​(java.io.File execFile)
                               throws java.io.IOException
        Loads the given execution data file.
        Parameters:
        execFile - execution data file to load
        Throws:
        java.io.IOException - if the file can't be loaded
      • addXmlFormatter

        public void addXmlFormatter​(java.io.File targetfile,
                                    java.lang.String encoding)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • addCsvFormatter

        public void addCsvFormatter​(java.io.File targetfile,
                                    java.lang.String encoding)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • addHtmlFormatter

        public void addHtmlFormatter​(java.io.File targetdir,
                                     java.lang.String encoding,
                                     java.lang.String footer,
                                     java.util.Locale locale)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • addAllFormatters

        public void addAllFormatters​(java.io.File targetdir,
                                     java.lang.String encoding,
                                     java.lang.String footer,
                                     java.util.Locale locale)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • addRulesChecker

        public void addRulesChecker​(java.util.List<Rule> rules,
                                    IViolationsOutput output)
      • initRootVisitor

        public IReportVisitor initRootVisitor()
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • processProject

        public void processProject​(IReportGroupVisitor visitor,
                                   org.apache.maven.project.MavenProject project,
                                   java.util.List<java.lang.String> includes,
                                   java.util.List<java.lang.String> excludes)
                            throws java.io.IOException
        Calculates coverage for the given project and emits it to the report group without source references
        Parameters:
        visitor - group visitor to emit the project's coverage to
        project - the MavenProject
        includes - list of includes patterns
        excludes - list of excludes patterns
        Throws:
        java.io.IOException - if class files can't be read
      • processProject

        public void processProject​(IReportGroupVisitor visitor,
                                   java.lang.String bundeName,
                                   org.apache.maven.project.MavenProject project,
                                   java.util.List<java.lang.String> includes,
                                   java.util.List<java.lang.String> excludes,
                                   java.lang.String srcEncoding)
                            throws java.io.IOException
        Calculates coverage for the given project and emits it to the report group including source references
        Parameters:
        visitor - group visitor to emit the project's coverage to
        bundeName - name for this project in the report
        project - the MavenProject
        includes - list of includes patterns
        excludes - list of excludes patterns
        srcEncoding - encoding of the source files within this project
        Throws:
        java.io.IOException - if class files can't be read
      • processProject

        private void processProject​(IReportGroupVisitor visitor,
                                    java.lang.String bundeName,
                                    org.apache.maven.project.MavenProject project,
                                    java.util.List<java.lang.String> includes,
                                    java.util.List<java.lang.String> excludes,
                                    ISourceFileLocator locator)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getCompileSourceRoots

        private static java.util.List<java.io.File> getCompileSourceRoots​(org.apache.maven.project.MavenProject project)
      • resolvePath

        private static java.io.File resolvePath​(org.apache.maven.project.MavenProject project,
                                                java.lang.String path)