throws IOException, InterruptedException {
listener.getLogger().println("[CucumberReportPublisher] Compiling Cucumber Html Reports ...");
// source directory (possibly on slave)
FilePath workspaceJsonReportDirectory;
if (jsonReportDirectory.isEmpty()) {
workspaceJsonReportDirectory = build.getWorkspace();
} else {
workspaceJsonReportDirectory = new FilePath(build.getWorkspace(), jsonReportDirectory);
}
// target directory (always on master)
File targetBuildDirectory = new File(build.getRootDir(), "cucumber-html-reports");
if (!targetBuildDirectory.exists()) {
targetBuildDirectory.mkdirs();
}
String buildNumber = Integer.toString(build.getNumber());
String buildProject = build.getProject().getName();
if (Computer.currentComputer() instanceof SlaveComputer) {
listener.getLogger().println("[CucumberReportPublisher] copying all json files from slave: " + workspaceJsonReportDirectory.getRemote() + " to master reports directory: " + targetBuildDirectory);
} else {
listener.getLogger().println("[CucumberReportPublisher] copying all json files from: " + workspaceJsonReportDirectory.getRemote() + " to reports directory: " + targetBuildDirectory);
}
workspaceJsonReportDirectory.copyRecursiveTo("**/*.json", new FilePath(targetBuildDirectory));
// generate the reports from the targetBuildDirectory
Result result = Result.NOT_BUILT;
String[] jsonReportFiles = findJsonFiles(targetBuildDirectory);
if (jsonReportFiles.length != 0) {