Search in sources :

Example 1 with AntJacocoCheck

use of org.gradle.internal.jacoco.AntJacocoCheck in project gradle by gradle.

the class JacocoCoverageVerification method check.

@TaskAction
public void check() {
    final Spec<File> fileExistsSpec = new Spec<File>() {

        @Override
        public boolean isSatisfiedBy(File file) {
            return file.exists();
        }
    };
    JacocoCheckResult checkResult = new AntJacocoCheck(getAntBuilder()).execute(getJacocoClasspath(), getProject().getName(), getAllClassDirs().filter(fileExistsSpec), getAllSourceDirs().filter(fileExistsSpec), getExecutionData(), getViolationRules());
    if (!checkResult.isSuccess()) {
        throw new GradleException(checkResult.getFailureMessage());
    }
}
Also used : GradleException(org.gradle.api.GradleException) AntJacocoCheck(org.gradle.internal.jacoco.AntJacocoCheck) Spec(org.gradle.api.specs.Spec) File(java.io.File) JacocoCheckResult(org.gradle.internal.jacoco.JacocoCheckResult) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

File (java.io.File)1 GradleException (org.gradle.api.GradleException)1 Spec (org.gradle.api.specs.Spec)1 TaskAction (org.gradle.api.tasks.TaskAction)1 AntJacocoCheck (org.gradle.internal.jacoco.AntJacocoCheck)1 JacocoCheckResult (org.gradle.internal.jacoco.JacocoCheckResult)1