Skip to content

Commit

Permalink
pass CFG_VER_DESCRIPTION to tool builds
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Feb 27, 2025
1 parent 0becb57 commit f877b12
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,32 @@ pub fn prepare_tool_cargo(
cargo.env("CFG_VERSION", builder.rust_version());
cargo.env("CFG_RELEASE_NUM", &builder.version);
cargo.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel());

if let Some(ref ver_date) = builder.rust_info().commit_date() {
cargo.env("CFG_VER_DATE", ver_date);
}

if let Some(ref ver_hash) = builder.rust_info().sha() {
cargo.env("CFG_VER_HASH", ver_hash);
}

if let Some(description) = &builder.config.description {
cargo.env("CFG_VER_DESCRIPTION", description);
}

let info = GitInfo::new(builder.config.omit_git_hash, &dir);
if let Some(sha) = info.sha() {
cargo.env("CFG_COMMIT_HASH", sha);
}

if let Some(sha_short) = info.sha_short() {
cargo.env("CFG_SHORT_COMMIT_HASH", sha_short);
}

if let Some(date) = info.commit_date() {
cargo.env("CFG_COMMIT_DATE", date);
}

if !features.is_empty() {
cargo.arg("--features").arg(features.join(", "));
}
Expand Down

0 comments on commit f877b12

Please sign in to comment.