-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate tasks mode #43
Comments
This makes sense but I don't think it mitigates #20. If there are other annotation processors that generate code, like AutoValue, then those processors still need to run during the separate Checker Framework task. Otherwise, the Checker Framework task will fail with compilation errors. |
Actually it is no need to run processors within Checker task but generated code must be included as Checker task inputs. We use this technique in Android projects (Dagger, Autvalue etc.). In mixed Java+Kotlin tasks we add kapt output as input to Checker task. |
@vladimirfx you have a good point. It would be great if the plugin supported separate tasks, where the Checker task could just consume all the generated code from the annotation processors. |
One possible workaround for now: you can guard application of this plugin behind a Gradle property, and only supply the Gradle property when you want to run in "CI Mode". That would look something like the code snippet below. With that code, you can run plugins {
...
// To do Checker Framework pluggable type-checking (and other CI only tasks), run:
// ./gradlew compileJava -PisCI=true
id 'org.checkerframework' version '0.3.30' apply false
}
if (!project.hasProperty("isCI")) {
ext.isCI = "false"
}
if ("true".equals(project.ext.isCI)) {
apply plugin: 'org.checkerframework'
}
if ("true".equals(project.ext.isCI)) {
checkerFramework {
checkers = [ "org.checkerframework.checker.nullness.NullnessChecker",
"org.checkerframework.checker.signature.SignatureChecker",
"org.checkerframework.checker.optional.OptionalChecker",
"org.checkerframework.checker.index.IndexChecker",
"org.checkerframework.checker.regex.RegexChecker",
"org.checkerframework.checker.formatter.FormatterChecker",
"org.checkerframework.checker.propkey.PropertyKeyChecker"
]
}
} |
@kelloggm CI mode is good if developers do not check code locally. In our case devs do code cleanup by running ./gradlew check locally... |
@vladimirfx you could use the Gradle property trick locally as well. Can you say what is insufficient about use of a Gradle property? |
@msridhar as workaround it's possible, but requires some additional knowledge/documentation of build process. |
@vladimirfx Regarding your comment about 2.11.x, it's true that it works only on Java 8. Version 3.0.0 works on Java 8 and Java 11, so upgrading to 3.0.0 resolves that issue. |
@vladimirfx I agree that in many scenarios teams will want to run Checker Framework separately from their main build. Gradle flags provide one way to do that. I am not a Gradle expert, but I suspect one could make a separate task that just sets a flag before the normal build task is run? This way the flag would not need to be passed on the command line. You also have requirements around fine-grained control of source paths, to add kapt output, etc. For this scenario, do your custom Gradle scripts still work? They might need to be tweaked to stick Error Prone javac in the bootclasspath, but we can probably help with that and document that better. |
Please provide option to run CheckerFramework in separate tasks. This will solve many issues with interaction with other processors (#20) and make separation of assemble/check phases possible.
Currently we use this task description:
The text was updated successfully, but these errors were encountered: