Skip to content

How to properly do one dependency with two sets of features? #1727

Open
@luciusmagn

Description

@luciusmagn

We have a library, which has feature A.

One crate that depends on it does not need feature A, and so it is not enabled.

A second crate does need the feature on the library, and so it is enabled.

Our current solution in Bazel is:

  • Define the bazel rust_library target twice, one has the feature enabled and one doesn't, naming the one that does my_crate_feature
  • On the first crate, we add //path/to/my_crate to deps
  • On the second crate, we add //path/to/my_crate:my_crate_feature to deps
  • And also add { "//path/to/my_crate:my_crate_feature" : "my_crate" } to aliases.

This works, but I have an inkling feeling that we are doing it wrong.

Is this the correct way? How else could we tackle this scenario?

Thanks for any advice,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions