当前位置: 首页>>代码示例>>Java>>正文


Java CoverageBuilder.getBundle方法代码示例

本文整理汇总了Java中org.jacoco.core.analysis.CoverageBuilder.getBundle方法的典型用法代码示例。如果您正苦于以下问题:Java CoverageBuilder.getBundle方法的具体用法?Java CoverageBuilder.getBundle怎么用?Java CoverageBuilder.getBundle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jacoco.core.analysis.CoverageBuilder的用法示例。


在下文中一共展示了CoverageBuilder.getBundle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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");
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:17,代码来源:JacocoCoverageRunner.java

示例2: 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);
}
 
开发者ID:jonathanlermitage,项目名称:tikione-jacocoverage,代码行数:18,代码来源:JacocoNBModuleReportGenerator.java

示例3: 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);
}
 
开发者ID:facebook,项目名称:buck,代码行数:17,代码来源:ReportGenerator.java

示例4: 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);
}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:12,代码来源:ReportGenerator.java

示例5: 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);
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:8,代码来源:ExecutionDataParser.java

示例6: 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);
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:10,代码来源:ReportGenerator.java

示例7: 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);
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:15,代码来源:DataParser.java

示例8: 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);
}
 
开发者ID:quelltextlich,项目名称:jacoco-toolbox,代码行数:17,代码来源:ReportTool.java

示例9: 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[] includes = {FrameworkConstants.CLASS_FILE_PATTERN}; //class file patten to be include
        String exclusionList = CodeCoverageUtils.getExclusionJarsPattern(",");
        String[] excludes = exclusionList.split(",");

        final List<File> filesToAnalyze =
                FileUtils.getFiles(classesDirectory,
                                   CodeCoverageUtils.getInclusionJarsPattern(","),
                                   exclusionList);

        for (final File file : filesToAnalyze) {

            String extractedDir = CodeCoverageUtils.extractJarFile(file.getAbsolutePath());
            log.info("Jar file analyzed for coverage : " + file.getName());
            String[] classFiles = CodeCoverageUtils.scanDirectory(extractedDir, includes, excludes);

            for (String classFile : classFiles) {
                analyzer.analyzeAll(new File(extractedDir + File.separator + classFile));
            }
            FileUtils.forceDelete(new File(extractedDir));
        }
        return coverageBuilder.getBundle("Overall Coverage Summary");
    }
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:28,代码来源:ReportGenerator.java

示例10: 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);

    for (File file : sourceData.getClassesDirectory()) {
        analyzer.analyzeAll(file);
    }

    return coverageBuilder.getBundle(title);
}
 
开发者ID:resios,项目名称:jacoco-coverage,代码行数:12,代码来源:ReportGenerator.java

示例11: 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[] jarsPath = classesPath.split(":");
        for (String jarPath : jarsPath) {
                analyzer.analyzeAll(new File(jarPath));
        }

        return coverageBuilder.getBundle(title);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:13,代码来源:ReportGenerator.java

示例12: toHtmlReport

import org.jacoco.core.analysis.CoverageBuilder; //导入方法依赖的package包/类
/**
 * Load a JaCoCo binary report and convert it to HTML.
 * <br/>See <a href="http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java">report generator example code</a>.
 *
 * @param jacocoexec the JaCoCo binary report.
 * @param reportdir the folder to store HTML report.
 * @param prjClassesDir the directory containing project's compiled classes.
 * @param prjSourcesDir the directory containing project's Java source files.
 * @param projectName the project's name.
 * @return the absolute path of HTML report's {@code index.html} file.
 * @throws FileNotFoundException if the JaCoCo binary report, compiled classes or Java sources files directory can't be found.
 * @throws IOException if an I/O error occurs.
 */
public static String toHtmlReport(File jacocoexec, File reportdir, File prjClassesDir, File prjSourcesDir, String projectName)
        throws FileNotFoundException,
               IOException {
    // Load the JaCoCo binary report.
    FileInputStream fis = new FileInputStream(jacocoexec);
    ExecutionDataStore executionDataStore = new ExecutionDataStore();
    SessionInfoStore sessionInfoStore = new SessionInfoStore();
    try {
        ExecutionDataReader executionDataReader = new ExecutionDataReader(fis);
        executionDataReader.setExecutionDataVisitor(executionDataStore);
        executionDataReader.setSessionInfoVisitor(sessionInfoStore);
        while (executionDataReader.read()) {
        }
    } finally {
        fis.close();
    }

    // Convert the binary report to HTML.
    CoverageBuilder coverageBuilder = new CoverageBuilder();
    Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
    analyzer.analyzeAll(prjClassesDir);
    IBundleCoverage bundleCoverage = coverageBuilder.getBundle("JaCoCoverage analysis of project \"" + projectName
            + "\" (powered by JaCoCo from EclEmma)");
    HTMLFormatter htmlformatter = new HTMLFormatter();
    IReportVisitor visitor = htmlformatter.createVisitor(new FileMultiReportOutput(reportdir));
    visitor.visitInfo(sessionInfoStore.getInfos(), executionDataStore.getContents());
    visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(prjSourcesDir, DEF_ENCODING, 4));
    visitor.visitEnd();
    return new File(reportdir, "index.html").getAbsolutePath();
}
 
开发者ID:jonathanlermitage,项目名称:tikione-jacocoverage,代码行数:44,代码来源:JaCoCoReportAnalyzer.java

示例13: toXmlReport

import org.jacoco.core.analysis.CoverageBuilder; //导入方法依赖的package包/类
/**
 * Load a JaCoCo binary report and convert it to XML.
 * <br/>See <a href="http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java">report generator example code</a>.
 *
 * @param jacocoexec the JaCoCo binary report.
 * @param xmlreport the XML file to generate.
 * @param prjClassesDir the directory containing project's compiled classes.
 * @param prjSourcesDir the directory containing project's Java source files.
 * @throws FileNotFoundException if the JaCoCo binary report, compiled classes or Java sources files directory can't be found.
 * @throws IOException if an I/O error occurs.
 */
public static void toXmlReport(File jacocoexec, File xmlreport, File prjClassesDir, File prjSourcesDir)
        throws FileNotFoundException,
               IOException {
    // Load the JaCoCo binary report.
    FileInputStream fis = new FileInputStream(jacocoexec);
    ExecutionDataStore executionDataStore = new ExecutionDataStore();
    SessionInfoStore sessionInfoStore = new SessionInfoStore();
    try {
        ExecutionDataReader executionDataReader = new ExecutionDataReader(fis);
        executionDataReader.setExecutionDataVisitor(executionDataStore);
        executionDataReader.setSessionInfoVisitor(sessionInfoStore);
        while (executionDataReader.read()) {
        }
    } finally {
        fis.close();
    }

    // Convert the binary report to XML.
    CoverageBuilder coverageBuilder = new CoverageBuilder();
    Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
    analyzer.analyzeAll(prjClassesDir);
    IBundleCoverage bundleCoverage = coverageBuilder.getBundle("JaCoCoverage analysis (powered by JaCoCo from EclEmma)");
    XMLFormatter xmlformatter = new XMLFormatter();
    xmlformatter.setOutputEncoding(DEF_ENCODING);
    IReportVisitor visitor = xmlformatter.createVisitor(new FileOutputStream(xmlreport));
    visitor.visitInfo(sessionInfoStore.getInfos(), executionDataStore.getContents());
    visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(prjSourcesDir, DEF_ENCODING, 4));
    visitor.visitEnd();
}
 
开发者ID:jonathanlermitage,项目名称:tikione-jacocoverage,代码行数:41,代码来源:JaCoCoReportAnalyzer.java

示例14: createBundle

import org.jacoco.core.analysis.CoverageBuilder; //导入方法依赖的package包/类
/**
 * Create an IBundleCoverage for the given ExecutionDataStore.
 * 
 * @param executionDataStore
 *            the execution data.
 * @return the coverage data.
 * @throws IOException
 *             if class files can't be read
 */
public IBundleCoverage createBundle(final ExecutionDataStore executionDataStore) throws IOException {
    final CoverageBuilder builder = new CoverageBuilder();
    final Analyzer analyzer = createAnalyzer(executionDataStore, builder);
    final File classesDir = new File(project.getBuild().getOutputDirectory());

    @SuppressWarnings("unchecked")
    final List<File> filesToAnalyze = FileUtils.getFiles(classesDir, fileFilter.getIncludes(), fileFilter.getExcludes());

    for (final File file : filesToAnalyze) {
        analyzer.analyzeAll(file);
    }

    return builder.getBundle(project.getName());
}
 
开发者ID:timezra,项目名称:jacoco-scala-maven-plugin,代码行数:24,代码来源:BundleCreator.java


注:本文中的org.jacoco.core.analysis.CoverageBuilder.getBundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。