本文整理汇总了Java中org.jacoco.core.analysis.CoverageBuilder类的典型用法代码示例。如果您正苦于以下问题:Java CoverageBuilder类的具体用法?Java CoverageBuilder怎么用?Java CoverageBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CoverageBuilder类属于org.jacoco.core.analysis包,在下文中一共展示了CoverageBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzeExternal
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private AnalyzedNodes analyzeExternal(final IPackageFragmentRoot root)
throws CoreException {
IPath location = null;
try {
location = root.getPath();
AnalyzedNodes nodes = cache.get(location);
if (nodes != null) {
return nodes;
}
final CoverageBuilder builder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executiondata, builder);
new ResourceTreeWalker(analyzer).walk(location);
nodes = new AnalyzedNodes(builder.getClasses(), builder.getSourceFiles());
cache.put(location, nodes);
return nodes;
} catch (Exception e) {
throw new CoreException(EclEmmaStatus.BUNDLE_ANALYSIS_ERROR.getStatus(
root.getElementName(), location, e));
}
}
示例2: analyzeStructure
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
@VisibleForTesting
IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
Set<String> alreadyInstrumentedClasses = new HashSet<>();
for (File classesJar : classesJars) {
if (isNewCoverageImplementation) {
analyzeUninstrumentedClassesFromJar(analyzer, classesJar, alreadyInstrumentedClasses);
} else {
analyzer.analyzeAll(classesJar);
}
}
// TODO(bazel-team): Find out where the name of the bundle can pop out in the report.
return coverageBuilder.getBundle("isthisevenused");
}
示例3: processNBModule
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
public void processNBModule(String projectName, List<String> classDirectories, List<String> sourceDirectories) throws IOException {
CoverageBuilder coverageBuilder = new CoverageBuilder();
Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
for (String classDirectory : classDirectories) {
analyzer.analyzeAll(new File(classDirectory));
}
IBundleCoverage bundleCoverage = coverageBuilder.getBundle(projectName);
MultiSourceFileLocator sourceLocator = new MultiSourceFileLocator(4);
for (String sourceDirectory : sourceDirectories) {
sourceLocator.add(new DirectorySourceFileLocator(new File(sourceDirectory), DEF_ENCODING, 4));
}
groupVisitor.visitBundle(bundleCoverage, sourceLocator);
}
示例4: analyzeStructure
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
String[] classesDirs = classesPath.split(":");
for (String classesDir : classesDirs) {
File classesDirFile = new File(classesDir);
if (classesDirFile.exists()) {
for (File clazz : FileUtils.getFiles(classesDirFile, coverageIncludes, coverageExcludes)) {
analyzer.analyzeAll(clazz);
}
}
}
return coverageBuilder.getBundle(title);
}
示例5: analyzeInternal
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private AnalyzedNodes analyzeInternal(final IPackageFragmentRoot root)
throws CoreException {
IResource location = null;
try {
location = getClassfilesLocation(root);
if (location == null) {
TRACER.trace("No class files found for package fragment root {0}", //$NON-NLS-1$
root.getPath());
return AnalyzedNodes.EMPTY;
}
AnalyzedNodes nodes = cache.get(location);
if (nodes != null) {
return nodes;
}
final CoverageBuilder builder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executiondata, builder);
new ResourceTreeWalker(analyzer).walk(location);
nodes = new AnalyzedNodes(builder.getClasses(), builder.getSourceFiles());
cache.put(location, nodes);
return nodes;
} catch (Exception e) {
throw new CoreException(EclEmmaStatus.BUNDLE_ANALYSIS_ERROR.getStatus(
root.getElementName(), location, e));
}
}
示例6: CoverageResults
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
public CoverageResults(CoverageBuilder coverageBuilder) {
this.coverageBuilder = coverageBuilder;
final int[] counter = new int[2];
coverageBuilder.getClasses().stream()
.map(IClassCoverage::getInstructionCounter)
.forEach(iCounter -> {
counter[0] += iCounter.getCoveredCount();
counter[1] += iCounter.getTotalCount();
});
this.instructionsCovered = counter[0];
this.instructionsTotal = counter[1];
}
示例7: coverageResults
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
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);
}
示例8: coverageResults
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private CoverageResults coverageResults(ExecutionDataStore executionData) {
final String classesDirectory = this.program.getProgramDir() + "/" + this.program.getClassesDir();
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);
}
示例9: analyzeStructure
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionDataStore,
coverageBuilder);
for (File file : classesDirectories) {
analyzer.analyzeAll(file);
}
return coverageBuilder.getBundle(title);
}
示例10: analyzeStructure
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private IBundleCoverage analyzeStructure(final ExecutionDataStore data)
throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(data, coverageBuilder);
analyzer.analyzeAll(classesDirectory);
return coverageBuilder.getBundle(coverageTitle);
}
示例11: analyzeCurrentDataStore
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private void analyzeCurrentDataStore()
{
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
try
{
analyzer.analyzeAll(classesToAnalyze, classesDirectory);
}
catch(IOException e)
{
}
/*
System.out.printf("Session \"%s\": %s - %s%n", currentInfo.getId(),
new Date(currentInfo.getStartTimeStamp()),
new Date(currentInfo.getDumpTimeStamp()));
*/
Collection<ISourceFileCoverage> sourceFiles = coverageBuilder.getSourceFiles();
results.put(currentInfo, sourceFiles);
for(ISourceFileCoverage sourceFile : sourceFiles)
{
ExecAnalyze.print_counters(sourceFile);
ExecAnalyze.print_source_counter_verbose(sourceFile);
}
}
示例12: analyzeStructure
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(
execFileLoader.getExecutionDataStore(), coverageBuilder);
analyzer.analyzeAll(classesDirectory);
return coverageBuilder.getBundle(title);
}
示例13: analyzeStructure
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
private IBundleCoverage analyzeStructure(final ExecutionDataStore data)
throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(data, coverageBuilder);
for(String dir : this.probe.getClassDirs()){
File classDir = new File(dir);
if(classDir.exists()){
analyzer.analyzeAll(classDir);
}
}
return coverageBuilder.getBundle(coverageTitle);
}
示例14: buildBundle
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
/**
* Builds a bundle for all loaded inputs
*/
private void buildBundle() {
final CoverageBuilder builder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(loader.getExecutionDataStore(),
builder);
for (final File file : analyzeFors) {
try {
analyzer.analyzeAll(file);
} catch (final IOException e) {
exit("Could not analyze for '" + file + "'", e);
}
}
bundle = builder.getBundle(title);
}
示例15: analyzeStructure
import org.jacoco.core.analysis.CoverageBuilder; //导入依赖的package包/类
protected CoverageBuilder analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionDataStore,
coverageBuilder);
analyzer.analyzeAll(classesDirectory);
return coverageBuilder;
}