Skip to content

Fix parse_cargo_tree_output misclassifying dev-dependencies as host deps#3976

Merged
UebelAndre merged 3 commits intobazelbuild:mainfrom
jonremy:jonremy/parse-cargo-tree-fix
Apr 20, 2026
Merged

Fix parse_cargo_tree_output misclassifying dev-dependencies as host deps#3976
UebelAndre merged 3 commits intobazelbuild:mainfrom
jonremy:jonremy/parse-cargo-tree-fix

Conversation

@jonremy
Copy link
Copy Markdown
Contributor

@jonremy jonremy commented Apr 17, 2026

Fix parse_cargo_tree_output incorrectly classifying [dev-dependencies] as host dependencies when they follow [build-dependencies] for the same crate.

This causes platform-conditional features to leak across platforms in the generated BUILD files. For instance, the tokio feature taskdump that can only be enabled on linux could leak to other platforms.

Example dependency tree that triggers the issue:

;my-crate v0.1.0 (/my-crate);;
`-- ;tokio v1.49.0;bytes,full,taskdump;
[build-dependencies]
`-- ;anyhow v1.0.100;default,std;
[dev-dependencies]
`-- ;tokio-test v0.4.4;;
    `-- ;tokio v1.49.0;bytes,full,taskdump; (*)

This PR also updates surrounding code in parse_cargo_tree_output. Let me know if you'd prefer a minimal fix instead.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 17, 2026

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.

@UebelAndre UebelAndre self-requested a review April 19, 2026 22:02
Copy link
Copy Markdown
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Thank you!

@UebelAndre UebelAndre added this pull request to the merge queue Apr 20, 2026
Merged via the queue into bazelbuild:main with commit ad14c2b Apr 20, 2026
3 checks passed
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.

2 participants