Skip to content

Make install-tools command work from any directory in the workspace. #2725

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

Merged
merged 4 commits into from
May 6, 2025

Conversation

egithinji
Copy link
Member

This fixes #2708 by creating a CARGO_WORKSPACE_DIR env variable to act as an anchor path, allowing the installation of mdbook-exerciser and mdbook-course to succeed from any directory within the repository. Based on the approach mentioned here: rust-lang/cargo#3946 (comment)

@@ -54,6 +54,11 @@ fn execute_task() -> Result<()> {
fn install_tools() -> Result<()> {
println!("Installing project tools...");

let path_to_mdbook_exerciser =
format!("{}mdbook-exerciser", env!("CARGO_WORKSPACE_DIR"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to wrap the workspace dir from the environment in a Path and join here with the directory name to get a proper path that can be easily converted to a string. That way you don't get into the trouble of formatting with the right dir separators.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes true thanks, done.

@michael-kerscher
Copy link
Collaborator

regarding the failed vi build I created #2726 which should get rid of some spurious fails from the test framework

@egithinji egithinji merged commit 291c2b0 into google:main May 6, 2025
35 checks passed
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.

xtask install-tools command requires being in root directory of project
2 participants