Skip to content

Commit b788640

Browse files
review: workspace path
1 parent 3b5be0b commit b788640

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

README.adoc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ This `xtask` is run in CI using the `--ci` parameter , which automatically exlud
120120

121121
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.
122122

123-
You can also run the the `xtask` with the `install-version <VERSION>` option, which will install the cargo subcommand into your user's `.cargo` directory:
124-
125-
[source,text]
126-
----
127-
$ cargo xtask check-features --install-version 0.6.28
128-
----
129-
130123
To limit the max number of simultaneous feature flags combined for checking, run the `xtask` with the `--depth <NUM>` flag:
131124

132125
[source,text]

dev-tools/xtask/src/check_features.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! Subcommand: cargo xtask check-features
66
77
use anyhow::{bail, Result};
8-
use camino::{Utf8Path, Utf8PathBuf};
8+
use camino::Utf8PathBuf;
99
use clap::Parser;
1010
use std::{collections::HashSet, process::Command};
1111

@@ -115,14 +115,18 @@ fn os_name() -> Result<Os> {
115115
Ok(os)
116116
}
117117

118-
/// Get the path to the `out` directory.
118+
/// This is a workaround for the lack of a CARGO_WORKSPACE_DIR environment
119+
/// variable, as suggested in <https://github.com/rust-lang/cargo/issues/3946#issuecomment-1433384192>.
120+
/// A better workaround might be to set this in the `[env]` section of
121+
/// `.cargo/config.toml`.
122+
fn project_root() -> Utf8PathBuf {
123+
Utf8PathBuf::from(&concat!(env!("CARGO_MANIFEST_DIR"), "/.."))
124+
}
125+
126+
/// Get the path to the `out` directory from the project root/workspace
127+
/// directory.
119128
fn out_dir() -> Utf8PathBuf {
120-
if let Ok(omicron_dir) = std::env::var("OMICRON") {
121-
Utf8Path::new(format!("{}/out/cargo-hack", omicron_dir).as_str())
122-
.to_path_buf()
123-
} else {
124-
Utf8Path::new("out/cargo-hack").to_path_buf()
125-
}
129+
project_root().join("out/cargo-hack")
126130
}
127131

128132
/// Install `cargo-hack` if the `install-version` was specified; otherwise,

0 commit comments

Comments
 (0)