-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from zacshowa/address-toolchain-issues
Address `dev` branch toolchain issues.
- Loading branch information
Showing
5 changed files
with
38 additions
and
18 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
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,7 +1,21 @@ | ||
use vergen::{Config, ShaKind}; | ||
use std::process::Command; | ||
|
||
const GIT_HASH_ENV_VAR: &str = "GIT_SHA_SHORT"; | ||
|
||
fn main() { | ||
let mut config = Config::default(); | ||
*config.git_mut().sha_kind_mut() = ShaKind::Short; | ||
let _ = vergen::vergen(config); | ||
//Build command to retrieve the short git commit hash | ||
let git_process_output = Command::new("git") | ||
.arg("rev-parse") | ||
.arg("--short") | ||
.arg("HEAD") | ||
.output() | ||
.expect("Failed to retrieve short git commit hash"); | ||
|
||
//Parse the raw output into a string, we still need to remove the newline character | ||
let git_hash_raw = | ||
String::from_utf8(git_process_output.stdout).expect("Failed to convert git hash to string"); | ||
//Remove the newline character from the short git commit hash | ||
let git_hash = git_hash_raw.trim_end_matches('\n'); | ||
|
||
println!("cargo:rustc-env={}={}", GIT_HASH_ENV_VAR, git_hash); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[toolchain] | ||
channel = "1.73.0" |
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