diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-18 06:44:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-18 06:44:45 +0200 |
| commit | 06d403d67076dabd263ff038979f791b07853a3f (patch) | |
| tree | 038a8b09a97cf69c862405aea06c562afc9c2b73 /src/bootstrap | |
| parent | e279f902f31af1e111f2a951781c9eed82f8c360 (diff) | |
| parent | 0a763c92f214501ccd0460fdddfbb49d21fe9b2e (diff) | |
| download | rust-06d403d67076dabd263ff038979f791b07853a3f.tar.gz rust-06d403d67076dabd263ff038979f791b07853a3f.zip | |
Rollup merge of #109981 - duckymirror:issue-107094, r=albertlarsan68
Set commit information environment variables when building tools This fixes #107094. ~I'm trying to add a regression test for this issue.~ **Update**: I've added a test and a new test header `needs-git-hash` which makes sure it doesn't run when commit hashes are ignored (`bootstrap`'s `ignore-git` option).
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/test.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/tool.rs | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index aedf1ecab13..3814dc63ed4 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1804,6 +1804,10 @@ note: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--channel").arg(&builder.config.channel); + if !builder.config.omit_git_hash { + cmd.arg("--git-hash"); + } + if let Some(commit) = builder.config.download_rustc_commit() { cmd.env("FAKE_DOWNLOAD_RUSTC_PREFIX", format!("/rustc/{commit}")); } diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index c732fd7e833..79fab00efe7 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -194,6 +194,12 @@ 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); + } let info = GitInfo::new(builder.config.omit_git_hash, &dir); if let Some(sha) = info.sha() { |
