diff --git a/README.adoc b/README.adoc index 2183f6e0faa..4979411d73d 100644 --- a/README.adoc +++ b/README.adoc @@ -120,13 +120,6 @@ This `xtask` is run in CI using the `--ci` parameter , which automatically exlud If `cargo hack` is not already installed in omicron's `out/` directory, a pre-built binary will be installed automatically depending on your operating system and architecture. -You can also run the the `xtask` with the `install-version ` option, which will install the cargo subcommand into your user's `.cargo` directory: - -[source,text] ----- -$ cargo xtask check-features --install-version 0.6.28 ----- - To limit the max number of simultaneous feature flags combined for checking, run the `xtask` with the `--depth ` flag: [source,text] diff --git a/dev-tools/xtask/src/check_features.rs b/dev-tools/xtask/src/check_features.rs index f4efd6791ce..9d8bcac256a 100644 --- a/dev-tools/xtask/src/check_features.rs +++ b/dev-tools/xtask/src/check_features.rs @@ -115,14 +115,18 @@ fn os_name() -> Result { Ok(os) } -/// Get the path to the `out` directory. +/// This is a workaround for the lack of a CARGO_WORKSPACE_DIR environment +/// variable, as suggested in https://github.com/rust-lang/cargo/issues/3946#issuecomment-1433384192. +/// A better workaround might be to set this in the `[env]` section of +/// `.cargo/config.toml`. +fn project_root() -> Utf8PathBuf { + Utf8PathBuf::from(&concat!(env!("CARGO_MANIFEST_DIR"), "/..")) +} + +/// Get the path to the `out` directory from the project root/workspace +/// directory. fn out_dir() -> Utf8PathBuf { - if let Ok(omicron_dir) = std::env::var("OMICRON") { - Utf8Path::new(format!("{}/out/cargo-hack", omicron_dir).as_str()) - .to_path_buf() - } else { - Utf8Path::new("out/cargo-hack").to_path_buf() - } + project_root().join("out/cargo-hack") } /// Install `cargo-hack` if the `install-version` was specified; otherwise,