-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Allow to use Action for configuration in extensions to better support non-Groovy consumers (#187) #404
Conversation
… non-Groovy consumers (dependency-check#187)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |
How are users expected to use the Action variants in Groovy to avoid the deprecations? Was it necessary to deprecate all the closure variants here? |
Without deprecation it is hard to later remove them. In Groovy you have the two possibilities to either ignore the deprecation warning, or explicitly using the Or you switch over to Kotlin DSL instead. By now it is the default DSL, you immediately get type-safe build scripts, actually helpful error messages if you mess up the syntax, and amazingly better IDE support when using a good IDE like IntelliJ IDEA or Android Studio. :-) |
I understand that re kotlin, but some of us have massive multi project Gradle builds and moving to kotlin is significant effort better spent elsewhere. The question is around how to even use the action variant within groovy (the syntax). If there is no canonical (non clunky) way to do so, and if we are not deprecating support for groovy entirely, they probably shouldn't be marked as deprecated. Training folks to ignore deprecation warnings is not helpful. Currently the documentation doesn't show folks how to use a non-deprecated approach. |
Wouldn't it just be:
Basically just replace the |
Well, this plugin's documentation should imho not be a Groovy language documentation, that is up to Groovy. ;-) dependencyCheck {
proxy({
it.port = 0
} as Action)
} Or you use neither by doing dependencyCheck {
proxy.port = 0
} Besidest that, even with dependencyCheck {
proxy {
port = 0
}
} Gradle does not complain with a deprecation warning for me. |
I really should update the docs to be kotlin at some point... |
Ahh thanks, despite many years of using Gradle it wasn't obvious to me that moving to dot syntax is what it takes to move to using the actions overloads. I guess this is the difference from the perspective of users vs Gradle plugin authors; as the closure syntax is the canonical way in Gradle-groovy to group related configration in a DSL-like syntax.
Gradle doesn't complain, but IntelliJ IDEA (correctly) does, as this is passing a closure. |
The closure style has been deprecated as of dependency-check/dependency-check-gradle#404 Signed-off-by: Chad Wilson <[email protected]>
That would be quite strange and is not what is happening as I said above. |
OK, maybe better to ignore whether it is "actions syntax" or "neither" from my comment - I'm probably better to have written it as "to move to using a non-deprecated approach". I don't actually know how Gradle DSL magic translates these syntaxes internally to bind to the overloads/extension config classes, especially when using |
fixes #187