use of org.jacoco.core.analysis.Analyzer in project jacoco by jacoco.
the class ValidationTestBase method analyze.
private void analyze(final ExecutionDataStore store) throws IOException {
final CoverageBuilder builder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(store, builder);
for (ExecutionData data : store.getContents()) {
analyze(analyzer, data);
}
String srcName = target.getName().replace('.', '/') + ".java";
for (ISourceFileCoverage file : builder.getSourceFiles()) {
if (srcName.equals(file.getPackageName() + "/" + file.getName())) {
sourceCoverage = file;
return;
}
}
fail("No source node found for " + srcName);
}
use of org.jacoco.core.analysis.Analyzer in project dspot by STAMP-project.
the class JacocoListener method coverageResults.
private CoverageResults coverageResults(ExecutionDataStore executionData) {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionData, coverageBuilder);
try {
analyzer.analyzeAll(new File(classesDirectory));
} catch (IOException e) {
throw new RuntimeException(e);
}
return new CoverageResults(coverageBuilder);
}
use of org.jacoco.core.analysis.Analyzer in project sonar-java by SonarSource.
the class JacocoReportReader method analyzeFiles.
/**
* Caller must guarantee that {@code classFiles} are actually class file.
*/
public CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles) {
CoverageBuilder coverageBuilder = new CoverageBuilder();
if (useCurrentBinaryFormat) {
Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
} else {
org.jacoco.previous.core.analysis.Analyzer analyzer = new org.jacoco.previous.core.analysis.Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
}
logNoMatchClasses(coverageBuilder.getNoMatchClasses());
return coverageBuilder;
}
use of org.jacoco.core.analysis.Analyzer in project bazel by bazelbuild.
the class JacocoCoverageRunner method analyzeStructure.
private IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
for (File classesJar : classesJars) {
analyzer.analyzeAll(classesJar);
}
// TODO(bazel-team): Find out where the name of the bundle can pop out in the report.
return coverageBuilder.getBundle("isthisevenused");
}
use of org.jacoco.core.analysis.Analyzer in project powermock by powermock.
the class JacocoCoverageTest method collectCoverage.
private CoverageBuilder collectCoverage(ExecutionDataStore executionData) throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionData, coverageBuilder);
for (String className : TARGET) {
analyzer.analyzeClass(getClass().getResourceAsStream(classNameToFileName(className)), className);
}
return coverageBuilder;
}
Aggregations