I am trying to develop a binary. I believe that a significant piece of its functionality is reusable and belongs in its own library. As a result, I intend to develop binary crate
B and library crate
B has a dependency on
However, I'm not sure how to make the dependencies work out. For development, I need to have
B depend on
L with a
path dependency, because
L hasn't been pushed to crates.io yet. However, when I push them to crates.io they should be pushed as separate packages, and
B's package should depend on
L via a crates.io dependency.
How should I develop these crates?
What I have tried:
I put both crates into a workspace for local development, then used
[patch.crates-io] in the workspace to rewrite
B's dependency on
L into a
path dependency. This also has compile time benefits, and lets me run all the repository's tests simultaneously. However, if I try to set profile settings on
B, I get a warning that I should set the profile settings in the workspace:
warning: profiles for the non root package will be ignored, specify profiles at the workspace root: package: /home/jrvanwhy/gitree/gitree/Cargo.toml workspace: /home/jrvanwhy/gitree/Cargo.toml
However, I want those profile settings to apply when I publish
B, where the workspace won't be present, so I don't want to specify them in the workspace.