-
Notifications
You must be signed in to change notification settings - Fork 32
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
FR - patching APIs + auto-patch #38
Comments
This is something I had been thinking about for the very first version of this plugin: tbroyer/gradle-errorprone-plugin-v0.0.x#65 One thing is sure, I wouldn't use a project property or system property. I had been thinking about specific tasks (using For the time being, please experiment in your own build scripts (things should be doable in less than 30 lines of Groovy/Kotlin Gradle DSL), and we can see later whether and how to integrate it into the plugin. |
Actually I think this doesn't need anything from the library if you use /**
* Adds common configuration for error prone on projects. Note that this still uses application of the error prone
* plugin as an opt-in marker for now, and is not applied to every project.
*/
private fun Project.configureErrorProne() {
pluginManager.onPlugin("net.ltgt.errorprone") {
dependencies.add("errorprone", "com.google.errorprone:error_prone_core:$ERROR_PRONE_VERSION")
if (!Jvm.current().javaVersion!!.isJava9Compatible) {
dependencies.add("errorproneJavac", "com.google.errorprone:javac:9+181-r4173-1")
}
val javaCompileConfigurer = {
tasks.withType<JavaCompile>().onConfigureEach {
options.errorprone(actionOf {
disableWarningsInGeneratedCode.set(true)
if (project.hasProperty("epAutoPatch")) {
// Always log this verbosely
logger.lifecycle("Enabling error-prone auto-patching on ${project.path}:$name")
errorproneArgs.addAll(
"-XepPatchChecks:MissingOverride,DefaultCharset,DeadException,MutableConstantField,MethodCanBeStatic",
"-XepPatchLocation:IN_PLACE"
)
}
})
}
}
if (isAndroidProject) {
afterEvaluate {
javaCompileConfigurer()
}
} else {
javaCompileConfigurer()
}
}
} |
Looks like it only works if you don't use a |
http://errorprone.info/docs/patching
It would be great if this could be something enabled via invocation property, such as
-PautoPatch
and have the plugin manage the arguments + application of the generated patchThe text was updated successfully, but these errors were encountered: