-
Notifications
You must be signed in to change notification settings - Fork 206
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
add information about packaging crate #2408
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the improvement! This really helps!
Hey everyone. Sorry for taking so long. I have created a sample repo which showcases how workspaces packages cannot be build by using the commands as explained in the README.md file. Examplehttps://github.com/jonaspleyer/docs_rs_workspace_package Structure$ tree
.
├── Cargo.toml
├── my_lib
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
└── README.md
3 directories, 4 files The actual contents of
and $ cat my_lib/Cargo.toml
[package]
name = "my_lib"
version.workspace = true
[dependencies] BuildingThe build command cargo run -- build crate -l path/to/docs_rs_workspace_package/my_lib fails with Error: Building documentation failed
Caused by:
Building documentation failed
Caused by:
invalid Cargo.toml syntax which makes sense due to version.workspace = true FixHowever when running the following sequence of commands # Run this in the directory of docs_rs_workspace_package
cargo package -p my_lib and then building again # Run this from the docs.rs repo
cargo run -- build crate -l path/to/docs_rs_workspace_package/target/package/my_lib-0.1.0 then the build succeeds. |
@syphar how to we continue from here? This was a lot of information in my previous comment and I am unsure how to include it in the README.md |
There is a |
I have followed your suggestions. Somehow I feel a bit stressed when writing these things in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have inserted a more detailed description of when this problem occurs and how to circumvent it in the docs
folder. I hope that this is sufficiently detailed to give a clear explanation.
This is a minor addition. Usually when working with the
build crate -l
command, it is enough to apply it directly to the crate root.However, when using cargo features such as inheritance of workspace settings (ie.
version.workspace = true
) it is necessary to package the crate first withcargo package
.I am aware that the wording "package" should already make this clear. However, I stumbled across this problem personally and could not figure out the solution. Please correct me if I have overlooked any other documentation where this makes more sense.