-
Notifications
You must be signed in to change notification settings - Fork 50
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
Apply Checkstyle, SpotBugs, Jacoco plugins #220
Conversation
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.
Thanks @alextu! This looks great, just had a couple questions.
html.required = false | ||
} | ||
} | ||
project.afterEvaluate { |
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.
Is there a way to do this without afterEvaluate? I think the task could have an onlyIf that lazily evaluates the opt-in property?
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.
Very good suggestion, I've made the necessary changes
@@ -92,6 +95,9 @@ class JpiExtension implements JpiExtensionBridge { | |||
this.generateTests = project.objects.property(Boolean).convention(false) | |||
this.requireEscapeByDefaultInJelly = project.objects.property(Boolean).convention(true) | |||
this.generatedTestClassName = project.objects.property(String).convention('InjectedTest') | |||
this.checkstyleEnabled = project.objects.property(Boolean).convention(false) | |||
this.jacocoEnabled = project.objects.property(Boolean).convention(false) | |||
this.spotBugsEnabled = project.objects.property(Boolean).convention(false) |
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.
Do you think it makes sense to have a higher level property to allow opting into all the OSS recommendations? It's really nice to have this level of granularity, but I'm wondering if folks will basically want two modes most of the time - one for internal plugins, and one for oss plugins.
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.
That's a good question, how about having one single flag then configureQualityChecks
(false by default) that OSS plugins devs would set to true. Internal plugin devs would apply and configure quality plugins "manually" as for any Gradle projects.
The only limitation I see is that it would require conditionnal applying plugins in afterEvaluate
. That will not play well with configureQualityChecks = true
and customizing a plugin with an extension, since the plugin is not applied yet when Gradle evaluates the extension. In that case the user would have to fallback to configureQualityChecks = false
and configure manually as for internal plugins.
What do you think ?
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.
That's a really good point. Maybe it eventually makes sense to split into two plugins (oss, internal) for the different use-cases, but this is a good starting point and we can see where it evolves to. Happy to move forward with this.
7cb4be7
to
c07302c
Compare
Hey @alextu wanted to get your thoughts on strategies to avoid Gradle warnings when auto-applying community plugins. I may be a bit of an outlier here, but I like to run with One downside of always applying the spotbugs plugin is we end up getting warnings from Gradle, even when it's disabled. I don't think this applies with jacoco and checkstyle because they're included by default and I've never seen a default plugin warn. In this case the SpotBugsTask warns because it uses the deprecated
|
Yes that's indeed problematic to apply plugins even if not used.
What do you think ? |
Let's go with option 2, your preference looks good to me! |
Great, here's the PR #222 |
0.48.0 was released today with this change |
This fixes #217
Apply Checkstyle, SpotBugs, Jacoco plugins with some sensitive defaults:
Note that SpotBugs is only compatible with Gradle 7 and above, running with Gradle 6 will just not apply the SpotBugs plugin.