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

Take into account DependencyKind when collecting package target dependencies #2235

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

dmitrii-ubskii
Copy link
Contributor

When filtering out disabled dependencies for the Bazel targets, collect_deps_selectable() now takes into account the kind of dependency in question. Previously, if a disabled optional normal dependency was mandatory for a build script, it was erroneously filtered out.

This change resolves #2059

Copy link

google-cla bot commented Nov 2, 2023

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.

Copy link
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.

Thanks! All that's needed is a rebase and this can then be merged 😄

@dmitrii-ubskii
Copy link
Contributor Author

Rebased!

@UebelAndre
Copy link
Collaborator

Alas! I’m too late and another change was merged lol. One more rebase?

@dmitrii-ubskii
Copy link
Contributor Author

Done.

@UebelAndre UebelAndre merged commit d680d81 into bazelbuild:main Nov 3, 2023
3 checks passed
illicitonion pushed a commit that referenced this pull request Dec 1, 2023
Follow-up to #2235 that corrects the `DependencyKind` used. This bug
caused optional dependencies to be incorrectly _included_ even no
feature activated that dependency. This can lead to crates being
compiled with missing features, resulting in compile errors.

For example, `sqlx==0.7.3` compiled successfully with `0.30.0`, but
fails with `0.31.0`:
```toml
sqlx = { version = "0.7.3", default-features = false, features = ["sqlite"] }
```
because `default-features = false` should remove the [optional
dependency](https://github.com/launchbadge/sqlx/blob/c55aba0dc14f33b8a26cab6af565fcc4c8af8962/Cargo.toml#L54-L56)
`sqlx-macros`. Instead, however, it gets incorrectly included but with
its crate dependencies' features missing, resulting in compile errors.

Related issue:
- #2262
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.

Build / Optional Dependency Regression in v0.25.1
2 participants