class JacocoReportTask extends AndroidVariantTask {

    @TaskAction
    public void generateReport() throws IOException {
        Set<File> coverageFiles =
                coverageDirectories
                        .get()
                        .getAsFileTree()
                        .getFiles()
                        .stream()
                        .filter(File::isFile)
                        .collect(Collectors.toSet());

        if (coverageFiles.isEmpty()) {
            throw new IOException(
                    String.format(
                            "No coverage data to process in directories [%1$s]",
                            coverageDirectories.getFiles()));
        }
        executor.submit(
                JacocoReportWorkerAction.class,
                workerConfiguration -> {
                    workerConfiguration.setIsolationMode(IsolationMode.CLASSLOADER);
                    workerConfiguration.classpath(jacocoClasspath.getFiles());
                    workerConfiguration.setParams(
                            coverageFiles,
                            getReportDir(),
                            getClassFileCollection().getFiles(),
                            getSourceFolders().getFiles(),
                            getTabWidth(),
                            getReportName());
                });
    }

    @Inject public  JacocoReportTask(@NonNull WorkerExecutor executor);

}