Support ignoreFailures for checkAccessModifier
sghill opened this issue · 1 comments
The checkAccessModifier
task caught me by surprise. I understand its importance and will make necessary changes, none-the-less it might be worthwhile to consider it as a permissible option that just logs warnings before making it mandatory in the next release. The alternative is to just disable the task temporarily. So, I am good with this RC.
Originally posted by @roguexz in #175 (comment)
There is a VerificationTask in Gradle's api that adds this option. It's worth investigating the interface, but it may be more desirable to add properties to the task class for lazy configuration. That would open the door for configuring by project property org.jenkins-ci.jpi.checkAccessModifier.ignoreFailures=true
Ideally we'd also support Gradle's ability to fail on warnings when that property is set.
This is now done. Users can opt into failing the build with this configuration:
tasks.named('checkAccessModifier').configure {
ignoreFailures.set(false)
}
ignoreFailures
will become the default, most likely in v1.0.0. Users who opt-in now will be able to take advantage of Gradle's up-to-date checks. The task is considered up-to-date unless the sources or compileClasspath dependencies change.
I didn't end up implementing the VerificationTask
for two reasons:
- It declares a non-lazy property as an Input
- It's not clear there is much utility for users
The only reason I can come up with for implementing the interface is to be able to disable ignoreFailures
for all verification tasks. If there is someone who needs this functionality, feel free to reach out.
I considered implementing a project property, but I don't see an obvious order of precedence between configuring the task directly and project properties. It'd be fairly simple for a user to implement this functionality within a buildscript.