-
Notifications
You must be signed in to change notification settings - Fork 461
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
Don't redundantly apply BasePlugin #1226
Conversation
This sort of prevents use of predeclared deps because it doesn't check if the base plugin has already been applied. Better to just hook into this callback for when the plugin is applied and perform its relevant logic there
I don't have access to the assemble_and_test failure |
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.
After this change, it's possible, that base
might never get applied. The problem with that is there won't be a build
or check
task. Example user story:
- you have a multiproject build, where the subprojects all have
java
, but the root project has mostly nothing - you apply spotless to the root project for formatting docs
- you run
build
andcheck
in CI, and are surprised that Spotless isn't running- This story happened in spotlessCheck not run as part of a gradle build #1164
- Which is why we went back to applying base eagerly in Apply
base
eagerly to plugin-gradle #1179
Spotless always applied base eagerly until 6.0.3
when we stopped, then we started again because of the story above in 6.5.0
.
I want to solve your problem, but I'm stuck between that and not recreating the problems we created.
sort of prevents use of predeclared deps because it doesn't check if the base plugin has already been applied.
I don't understand why the eager application causes this.
@@ -35,8 +35,6 @@ public void apply(Project project) { | |||
if (project.hasProperty(SPOTLESS_MODERN)) { | |||
project.getLogger().warn("'spotlessModern' has no effect as of Spotless 5.0, recommend removing it."); | |||
} | |||
// make sure there's a `clean` and a `check` | |||
project.getPlugins().apply(BasePlugin.class); |
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.
From the gradle docs:
Applies the given plugin. Does nothing if the plugin has already been applied.
Also, you can see test failures here. |
Turned out to be a misunderstanding of the error traces we got in our codebase 👍 |
This sort of prevents use of predeclared deps because it doesn't check if the base plugin has already been applied. Better to just hook into this callback for when the plugin is applied and perform its relevant logic there