Skip to content

Commit

Permalink
review: workspace path
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanlakhani committed Jul 15, 2024
1 parent 3b5be0b commit b788640
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
7 changes: 0 additions & 7 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 <NUM>` flag:

[source,text]
Expand Down
20 changes: 12 additions & 8 deletions dev-tools/xtask/src/check_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Subcommand: cargo xtask check-features

use anyhow::{bail, Result};
use camino::{Utf8Path, Utf8PathBuf};
use camino::Utf8PathBuf;
use clap::Parser;
use std::{collections::HashSet, process::Command};

Expand Down Expand Up @@ -115,14 +115,18 @@ fn os_name() -> Result<Os> {
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,
Expand Down

0 comments on commit b788640

Please sign in to comment.