Package org.jacoco.maven
Class ReportSupport
- java.lang.Object
-
- org.jacoco.maven.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:- Create an instance
- Load one or multiple exec files with
loadExecutionData()
- Add one or multiple formatters with
addXXX()
methods - Create the root visitor with
initRootVisitor()
- Process one or multiple projects with
processProject()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ReportSupport.NoSourceLocator
private class
ReportSupport.SourceFileCollection
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<IReportVisitor>
formatters
private ExecFileLoader
loader
private org.apache.maven.plugin.logging.Log
log
-
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 referencesprivate 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 referencesprivate static java.io.File
resolvePath(org.apache.maven.project.MavenProject project, java.lang.String path)
-
-
-
Field Detail
-
log
private final org.apache.maven.plugin.logging.Log log
-
loader
private final ExecFileLoader loader
-
formatters
private final java.util.List<IReportVisitor> formatters
-
-
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 toproject
- the MavenProjectincludes
- list of includes patternsexcludes
- 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 tobundeName
- name for this project in the reportproject
- the MavenProjectincludes
- list of includes patternsexcludes
- list of excludes patternssrcEncoding
- 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
-
logBundleInfo
private void logBundleInfo(IBundleCoverage bundle, java.util.Collection<IClassCoverage> nomatch)
-
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)
-
-