Skip to content

Ability to tune unused dependency handling per target #1326

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

larshagencognite
Copy link

No description provided.

Copy link

google-cla bot commented Jun 2, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@@ -249,6 +249,18 @@ _common_attr = utils.add_dicts(
providers = [_JavacOptions],
mandatory = False,
),
"experimental_report_unused_deps": attr.string(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'd like to avoid collecting excessive attributes like these on the top level rule definitions so that we aren't cluttering our rule definitions over time.

Would you be open to using tags to opt targets out of this feature? There are a few examples around the codebase already where we follow this pattern.

Copy link
Author

Choose a reason for hiding this comment

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

I think tags for the unused deps report mode would work well, I assume you mean like this?

kt_experimental_report_unused_deps_off <-> experimental_report_unused_deps="off"
kt_experimental_report_unused_deps_warn <-> experimental_report_unused_deps="warn"
kt_experimental_report_unused_deps_error <-> experimental_report_unused_deps="error"

When it comes to defining a list of labels to ignore, I would assume it would have to be something like this?

kt_experimental_unused_deps_ignored_target:<target_label1>
kt_experimental_unused_deps_ignored_target:<target_label2>
kt_experimental_unused_deps_ignored_target:<target_label3>
...

Seems doable, did I capture your intention?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can leave out the kt_experimental_ for the tags. Since unused deps is going to be a fun exercise to get right, I expect this api will be around for a while.

@larshagencognite larshagencognite force-pushed the unused_deps_granular_control branch from 39126bc to 21888d4 Compare June 3, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants