Search in sources :

Example 1 with GenerateCodeCoverageReportStep

use of in project buck by facebook.

the class TestRunning method getReportCommand.

   * Returns the ShellCommand object that is supposed to generate a code coverage report from data
   * obtained during the test run. This method will also generate a set of source paths to the class
   * files tested during the test run.
private static Step getReportCommand(ImmutableSet<JavaLibrary> rulesUnderTest, DefaultJavaPackageFinder defaultJavaPackageFinder, JavaRuntimeLauncher javaRuntimeLauncher, ProjectFilesystem filesystem, SourcePathResolver sourcePathResolver, SourcePathRuleFinder ruleFinder, Path outputDirectory, CoverageReportFormat format, String title, boolean useIntermediateClassesDir, Optional<String> coverageIncludes, Optional<String> coverageExcludes) {
    ImmutableSet.Builder<String> srcDirectories = ImmutableSet.builder();
    ImmutableSet.Builder<Path> pathsToJars = ImmutableSet.builder();
    // Add all source directories of java libraries that we are testing to -sourcepath.
    for (JavaLibrary rule : rulesUnderTest) {
        ImmutableSet<String> sourceFolderPath = getPathToSourceFolders(rule, sourcePathResolver, ruleFinder, defaultJavaPackageFinder);
        if (!sourceFolderPath.isEmpty()) {
        Path classesItem = null;
        if (useIntermediateClassesDir) {
            classesItem = DefaultJavaLibrary.getClassesDir(rule.getBuildTarget(), filesystem);
        } else {
            SourcePath path = rule.getSourcePathToOutput();
            if (path != null) {
                classesItem = sourcePathResolver.getRelativePath(path);
        if (classesItem == null) {
    return new GenerateCodeCoverageReportStep(javaRuntimeLauncher, filesystem,,, outputDirectory, format, title, coverageIncludes, coverageExcludes);
Also used : Path(java.nio.file.Path) SourcePath(com.facebook.buck.rules.SourcePath) SourcePath(com.facebook.buck.rules.SourcePath) ImmutableSet( JavaLibrary( DefaultJavaLibrary( GenerateCodeCoverageReportStep(


DefaultJavaLibrary ( GenerateCodeCoverageReportStep ( JavaLibrary ( SourcePath (com.facebook.buck.rules.SourcePath)1 ImmutableSet ( Path (java.nio.file.Path)1