Skip to content
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

Document how to enable checkUnusedDependencies #2790

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ash211
Copy link
Contributor

@ash211 ash211 commented Apr 30, 2024

Before this PR

I mistakenly thought that com.palantir.baseline-exact-dependencies being applied (by default) meant that that check would run checkUnusedDependencies. Actually it does not, and repos wanting this behavior need to opt into it.

After this PR

==COMMIT_MSG==
Document how to enable checkUnusedDependencies
==COMMIT_MSG==

This PR documents how repos can do that, so it's an easy copy+paste if desired.

Possible downsides?

None known


```gradle
allprojects {
apply plugin: 'java-library'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this line, my internal test repo fails with:

1: Task failed with an exception.
-----------
* Where:
Build file '/Volumes/git/my-project/build.gradle' line: 77

* What went wrong:
A problem occurred evaluating root project 'my-project'.
> Could not get unknown property 'checkUnusedDependencies' for root project 'my-project' of type org.gradle.api.Project.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

Maybe there's an alternate pattern that we should recommend instead, of only applying to subprojects that are Java type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably wouldn't be prescriptive in this documentation about putting this in allprojects - that's something that consumers can decide for themselves.

I'd just write something like:

+ tasks.check.dependsOn tasks.checkUnusedDependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants