checkerframework-gradle-plugin icon indicating copy to clipboard operation
checkerframework-gradle-plugin copied to clipboard

Per-task skipCheckerFramework option doesn't work

Open tmarback opened this issue 7 months ago • 2 comments

Hello!

I am trying to set up an additional build of the project's main sources before actually compiling with the Checker Framework enabled, so that the class files can be used with the @StaticallyExecutable annotation. Naturally, this task can't be run with Checker enabled, so I figured I could use the per-task exclusion setting that is listed on the instructions:

val preCompile = tasks.register<JavaCompile>("preCompile") {
    description = "Pre-compiles classes to use in static verification"

    classpath = sourceSets["main"].compileClasspath
    source = sourceSets["main"].java
    destinationDirectory = preCompiledClasses

    checkerFramework {
        skipCheckerFramework = true // Should disable Checker on this task
    }
}

However, what I'm finding is that the skipCheckerFramework setting at the task level has no effect at all, no matter which way I use it. Note that doing it exactly as the README says doesn't work either:

tasks.withType<JavaCompile>().configureEach {
    if (name.equals("preCompile")) {
        checkerFramework {
            skipCheckerFramework = true
        }
    }
}

In the end I had to tack on a Test at the end of the task name just so that it would get skipped by the excludeTests setting.

Am I using the setting wrong, or is there a specific setup needed for it to work?

(Using Gradle 8.8, checkerframework-gradle-plugin 0.6.42)

tmarback avatar Jul 11 '24 20:07 tmarback