-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cargo-ci -> Use repo_path!() to specify paths verbatim.
- Loading branch information
Showing
11 changed files
with
35 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,7 @@ | ||
use std::path::{Path, PathBuf}; | ||
use std::sync::LazyLock; | ||
|
||
static WORKSPACE_DIR: LazyLock<PathBuf> = LazyLock::new(|| { | ||
let output = std::process::Command::new(env!("CARGO")) | ||
.arg("locate-project") | ||
.arg("--workspace") | ||
.arg("--message-format=plain") | ||
.output() | ||
.unwrap() | ||
.stdout; | ||
|
||
let cargo_path = Path::new(std::str::from_utf8(&output).unwrap().trim()); | ||
|
||
cargo_path.parent().unwrap().to_path_buf() | ||
}); | ||
|
||
/// The root of the Cargo Workspace. Should be the repository root. | ||
pub fn workspace_dir() -> PathBuf { | ||
WORKSPACE_DIR.to_owned() | ||
} | ||
|
||
/// Where CI-related code is in the repository. | ||
pub fn ci_code_dir() -> PathBuf { workspace_dir().join(".ci") } | ||
|
||
/// The generic Cargo target directory. | ||
pub fn cargo_target_dir() -> PathBuf { | ||
workspace_dir().join("target") | ||
} | ||
use std::path::PathBuf; | ||
use repo_path::repo_path; | ||
|
||
/// Sub-directory of the Cargo target directory, which we use for any of our own build artifacts. | ||
pub fn target_dir() -> PathBuf { | ||
cargo_target_dir().join("ci") | ||
repo_path!("target/").join("ci") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters