forked from Rust-related/RustPython
Add git_tag()
This commit is contained in:
@@ -6,6 +6,7 @@ fn main() {
|
||||
"cargo:rustc-env=RUSTPYTHON_GIT_TIMESTAMP={}",
|
||||
git_timestamp()
|
||||
);
|
||||
println!("cargo:rustc-env=RUSTPYTHON_GIT_TAG={}", git_tag());
|
||||
println!("cargo:rustc-env=RUSTPYTHON_GIT_BRANCH={}", git_branch());
|
||||
}
|
||||
|
||||
@@ -17,6 +18,10 @@ fn git_timestamp() -> String {
|
||||
git(&["log", "-1", "--format=%cd"])
|
||||
}
|
||||
|
||||
fn git_tag() -> String {
|
||||
git(&["describe", "--all", "--always", "--dirty"])
|
||||
}
|
||||
|
||||
fn git_branch() -> String {
|
||||
git(&["rev-parse", "--abbrev-ref", "HEAD"])
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@ pub fn get_git_revision() -> String {
|
||||
option_env!("RUSTPYTHON_GIT_HASH").unwrap_or("").to_string()
|
||||
}
|
||||
|
||||
pub fn get_git_tag() -> String {
|
||||
option_env!("RUSTPYTHON_GIT_TAG").unwrap_or("").to_string()
|
||||
}
|
||||
|
||||
pub fn get_git_branch() -> String {
|
||||
option_env!("RUSTPYTHON_GIT_BRANCH")
|
||||
.unwrap_or("")
|
||||
|
||||
Reference in New Issue
Block a user