Improve Rust workspace ergonomics#6324
Conversation
ae766d1 to
9bf0b5e
Compare
|
I am not in favor of restricting default members to just the wrapper crate. We have the workspace so that you must build all rust code in the api repository. I am also not in favor of moving the target dir into a subdirectory. This would require adding documentation so that people are not confused as to where they are suppose to find build artifacts. I did however see the issue with documentation opening to msp430 crate first, I updated the README to show how to open to the wrapper crate. See the commit: 05b7a18 |
|
I feel like let _ = std::fs::create_dir("target");
let _ = std::fs::create_dir("target/doc");
let _ = std::fs::copy("../docs/img/favicon.ico", "target/doc/favicon.ico");
let _ = std::fs::copy("../docs/img/logo.png", "target/doc/logo.png"); |
That is the As for why I am so against this, I want to keep divergent behavior to a minimum, that is, if someone who has no clue of the project structure were to clone the repository, they would not be confused to see the target directory be generated. They would be confused to see that the target directory exist in the
Good catch, will update with the next round of commits. |
Right now, running
cargo doc --openin the root of the workspace generates docs for all members, but only opens the ones forarch/msp430. This might be confusing to devs. If we introduce adefault-membersfield to the workspace, then unless the--workspaceflag is given to cargo, only those members will be used when runningcargo {check,build,doc}.IMO this makes it more obvious that the workspace is just a DX thing, and makes it more explicitly opt-in. Note that this essentially mimics having the
binaryninjapackage as the root package in the workspace, where this behavior would be the default (see here). Also, sincebinaryninjacore-sysis a dependency ofbinaryninja, it'll always be pulled in so its inclusion in the list is not strictly necessary.Also, cargo was putting all its artifacts in
/target, but it would be better to keep that directory from polluting the project root, so I added a local cargo config file that moves it back into therustsubdir.