-
Notifications
You must be signed in to change notification settings - Fork 135
Fix unused dependencies breaking with gradle 6.4 #1338
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
Conversation
Generate changelog in
|
|
It's just markdown failing on linked URLs it can't resolve... this is really frustrating, I wish we could override it with a check or something.
|
| } | ||
|
|
||
| @Input | ||
| @InputFiles |
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.
this is really the key, if you don't set this then gradle doesn't wire up the tasks that produce various files inside these configurations as inputs...
I think we were just getting lucky before.
| if (GradleVersion.current().compareTo(GradleVersion.version("5.6")) >= 0) { | ||
| attributes.attribute( | ||
| LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, | ||
| project.getObjects().named(LibraryElements.class, LibraryElements.CLASSES)); | ||
| } | ||
| }); |
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.
This is mostly an optimisation so we don't force the production of jars since we can use the classes dirs.
Gradle 6.4 has made it so that it sometimes forces jars when resolving compileClasspath in order to be able to confidently extract the Automatic-Module-Name if there is one set in the manifest.
However I think we can always just use the classes dir for this case, as it won't change the behaviour.
| } | ||
|
|
||
| @Input | ||
| @InputFiles |
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.
should this be @Classpath?
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.
good catch, yep that will fix any ordering issues!
ferozco
left a comment
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.
Could we put together some sort of test for this?
|
so there was a test specifically for this, but it was accidentally running |
|
👍 Awesome, thanks @dansanduleac |
|
Released 3.12.1 |
Before this PR
checkUnusedDependencieswould break on gradle 6.4, because it tried to find the jars of other subprojects rather than theclassesdirectories, but the plugin didn't wire up task dependencies onto the jars.After this PR
==COMMIT_MSG==
Fix task dependencies onto other subprojects for
com.palantir.baseline-exact-dependenciestasks (checkUnusedDependencies,checkImplicitDependencies), so they work with gradle 6.4.==COMMIT_MSG==
Possible downsides?