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()
    • 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
      • 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 bundleName,
                                   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
        bundleName - 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 bundleName,
                                    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)