-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Decide what to do for plugins modifying upgraded properties at execution time #25836
Comments
We actually do the same in our code: gradle/subprojects/language-java/src/main/java/org/gradle/api/tasks/compile/JavaCompile.java Lines 239 to 241 in b9ac289
This is related to finalization of properties. |
I think this is a good thing. We introduced property finalization partially because we wanted to prevent this very use case. We couldn't do it for JavaBean properties, but by converting them to lazy props we get this validation. If you look at it like that (i.e. a new kind of validation), it is clear what we should do: introduce it as a deprecation warning, and break in the next major. We can implement this by treating |
So ErrorProne basically wants to make sure
I guess with Property solution would be:
I wonder if we should have |
Discussed this with @adammurdoch today. Tasks not modifying their inputs is definitely our goal in the foreseeable future. We should not break tasks that do this without warning, though. There seems to be two approaches available to us:
An additional benefit of 2) is that it applies to every JavaBean property, e.g. to properties of custom tasks introduced in builds etc. so we can phase out all the bad usage patterns out there. Meanwhile 1) only addresses bad usage patterns for OTOH, with 2) we would only address modifications via setters. For example, it wouldn't cover mutating multi-valued properties like lists wrt adding/removing items. Deprecating these mutations too could be possible, but would mean more work. |
ErrorProne should probably configure |
I've opened tbroyer/gradle-errorprone-plugin#97 for ErrorProne. |
Can we close this now since we introduced lenient finalization for upgraded properties? |
Yes we can, thanks! We implemented lenient finalization for migrated properties in #30715, that fixes also this issue. |
It seems some plugins modify property value in doFirst, e.g. ErrorPronePlugin does:
see source.
And after property upgrade we get:
Should we/can we handle that somehow? I guess in the end such plugins will need an update to be compatible
Let's decide what to do here for old plugins. Right now it seems difficult to make such plugins work with property upgrades.
Should we already display some warning at execution time even for "raw" type properties?
The text was updated successfully, but these errors were encountered: