Rollup merge of #137723 - onur-ozkan:cfg-ver-description, r=pietroalbini,weihanglo
Make `rust.description` more general-purpose and pass `CFG_VER_DESCRIPTION` Moves the `description` field from the `rust` section to the `build` section as it can be useful for tools and is not specific to rustc. Also passes this value to tool builds through the `CFG_VER_DESCRIPTION` env. Motivated from https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Propagate.20rust.2Edescription.20to.20tools.20in.20dist.20build
This commit is contained in:
commit
dac4ffd5c0
5 changed files with 37 additions and 14 deletions
|
@ -189,6 +189,17 @@
|
||||||
# The default stage to use for the `bench` subcommand
|
# The default stage to use for the `bench` subcommand
|
||||||
#bench-stage = 2
|
#bench-stage = 2
|
||||||
|
|
||||||
|
# A descriptive string to be appended to version output (e.g., `rustc --version`),
|
||||||
|
# which is also used in places like debuginfo `DW_AT_producer`. This may be useful for
|
||||||
|
# supplementary build information, like distro-specific package versions.
|
||||||
|
#
|
||||||
|
# The Rust compiler will differentiate between versions of itself, including
|
||||||
|
# based on this string, which means that if you wish to be compatible with
|
||||||
|
# upstream Rust you need to set this to "". However, note that if you set this to "" but
|
||||||
|
# are not actually compatible -- for example if you've backported patches that change
|
||||||
|
# behavior -- this may lead to miscompilations or other bugs.
|
||||||
|
#description = ""
|
||||||
|
|
||||||
# Build triple for the pre-compiled snapshot compiler. If `rustc` is set, this must match its host
|
# Build triple for the pre-compiled snapshot compiler. If `rustc` is set, this must match its host
|
||||||
# triple (see `rustc --version --verbose`; cross-compiling the rust build system itself is NOT
|
# triple (see `rustc --version --verbose`; cross-compiling the rust build system itself is NOT
|
||||||
# supported). If `rustc` is unset, this must be a platform with pre-compiled host tools
|
# supported). If `rustc` is unset, this must be a platform with pre-compiled host tools
|
||||||
|
@ -615,17 +626,6 @@
|
||||||
# If using tarball sources, default value is "auto-detect", otherwise, it's "dev".
|
# If using tarball sources, default value is "auto-detect", otherwise, it's "dev".
|
||||||
#channel = if "is a tarball source" { "auto-detect" } else { "dev" }
|
#channel = if "is a tarball source" { "auto-detect" } else { "dev" }
|
||||||
|
|
||||||
# A descriptive string to be appended to `rustc --version` output, which is
|
|
||||||
# also used in places like debuginfo `DW_AT_producer`. This may be useful for
|
|
||||||
# supplementary build information, like distro-specific package versions.
|
|
||||||
#
|
|
||||||
# The Rust compiler will differentiate between versions of itself, including
|
|
||||||
# based on this string, which means that if you wish to be compatible with
|
|
||||||
# upstream Rust you need to set this to "". However, note that if you are not
|
|
||||||
# actually compatible -- for example if you've backported patches that change
|
|
||||||
# behavior -- this may lead to miscompilations or other bugs.
|
|
||||||
#description = ""
|
|
||||||
|
|
||||||
# The root location of the musl installation directory. The library directory
|
# The root location of the musl installation directory. The library directory
|
||||||
# will also need to contain libunwind.a for an unwinding implementation. Note
|
# will also need to contain libunwind.a for an unwinding implementation. Note
|
||||||
# that this option only makes sense for musl targets that produce statically
|
# that this option only makes sense for musl targets that produce statically
|
||||||
|
|
|
@ -292,7 +292,7 @@ v(
|
||||||
v("release-channel", "rust.channel", "the name of the release channel to build")
|
v("release-channel", "rust.channel", "the name of the release channel to build")
|
||||||
v(
|
v(
|
||||||
"release-description",
|
"release-description",
|
||||||
"rust.description",
|
"build.description",
|
||||||
"optional descriptive string for version output",
|
"optional descriptive string for version output",
|
||||||
)
|
)
|
||||||
v("dist-compression-formats", None, "List of compression formats to use")
|
v("dist-compression-formats", None, "List of compression formats to use")
|
||||||
|
|
|
@ -248,23 +248,32 @@ pub fn prepare_tool_cargo(
|
||||||
cargo.env("CFG_VERSION", builder.rust_version());
|
cargo.env("CFG_VERSION", builder.rust_version());
|
||||||
cargo.env("CFG_RELEASE_NUM", &builder.version);
|
cargo.env("CFG_RELEASE_NUM", &builder.version);
|
||||||
cargo.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel());
|
cargo.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel());
|
||||||
|
|
||||||
if let Some(ref ver_date) = builder.rust_info().commit_date() {
|
if let Some(ref ver_date) = builder.rust_info().commit_date() {
|
||||||
cargo.env("CFG_VER_DATE", ver_date);
|
cargo.env("CFG_VER_DATE", ver_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref ver_hash) = builder.rust_info().sha() {
|
if let Some(ref ver_hash) = builder.rust_info().sha() {
|
||||||
cargo.env("CFG_VER_HASH", ver_hash);
|
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);
|
let info = GitInfo::new(builder.config.omit_git_hash, &dir);
|
||||||
if let Some(sha) = info.sha() {
|
if let Some(sha) = info.sha() {
|
||||||
cargo.env("CFG_COMMIT_HASH", sha);
|
cargo.env("CFG_COMMIT_HASH", sha);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(sha_short) = info.sha_short() {
|
if let Some(sha_short) = info.sha_short() {
|
||||||
cargo.env("CFG_SHORT_COMMIT_HASH", sha_short);
|
cargo.env("CFG_SHORT_COMMIT_HASH", sha_short);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(date) = info.commit_date() {
|
if let Some(date) = info.commit_date() {
|
||||||
cargo.env("CFG_COMMIT_DATE", date);
|
cargo.env("CFG_COMMIT_DATE", date);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !features.is_empty() {
|
if !features.is_empty() {
|
||||||
cargo.arg("--features").arg(features.join(", "));
|
cargo.arg("--features").arg(features.join(", "));
|
||||||
}
|
}
|
||||||
|
|
|
@ -894,6 +894,7 @@ define_config! {
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Build {
|
struct Build {
|
||||||
build: Option<String> = "build",
|
build: Option<String> = "build",
|
||||||
|
description: Option<String> = "description",
|
||||||
host: Option<Vec<String>> = "host",
|
host: Option<Vec<String>> = "host",
|
||||||
target: Option<Vec<String>> = "target",
|
target: Option<Vec<String>> = "target",
|
||||||
build_dir: Option<String> = "build-dir",
|
build_dir: Option<String> = "build-dir",
|
||||||
|
@ -1176,6 +1177,7 @@ define_config! {
|
||||||
incremental: Option<bool> = "incremental",
|
incremental: Option<bool> = "incremental",
|
||||||
default_linker: Option<String> = "default-linker",
|
default_linker: Option<String> = "default-linker",
|
||||||
channel: Option<String> = "channel",
|
channel: Option<String> = "channel",
|
||||||
|
// FIXME: Remove this field at Q2 2025, it has been replaced by build.description
|
||||||
description: Option<String> = "description",
|
description: Option<String> = "description",
|
||||||
musl_root: Option<String> = "musl-root",
|
musl_root: Option<String> = "musl-root",
|
||||||
rpath: Option<bool> = "rpath",
|
rpath: Option<bool> = "rpath",
|
||||||
|
@ -1583,6 +1585,7 @@ impl Config {
|
||||||
config.change_id = toml.change_id.inner;
|
config.change_id = toml.change_id.inner;
|
||||||
|
|
||||||
let Build {
|
let Build {
|
||||||
|
mut description,
|
||||||
build,
|
build,
|
||||||
host,
|
host,
|
||||||
target,
|
target,
|
||||||
|
@ -1831,7 +1834,7 @@ impl Config {
|
||||||
randomize_layout,
|
randomize_layout,
|
||||||
default_linker,
|
default_linker,
|
||||||
channel: _, // already handled above
|
channel: _, // already handled above
|
||||||
description,
|
description: rust_description,
|
||||||
musl_root,
|
musl_root,
|
||||||
rpath,
|
rpath,
|
||||||
verbose_tests,
|
verbose_tests,
|
||||||
|
@ -1924,7 +1927,12 @@ impl Config {
|
||||||
set(&mut config.jemalloc, jemalloc);
|
set(&mut config.jemalloc, jemalloc);
|
||||||
set(&mut config.test_compare_mode, test_compare_mode);
|
set(&mut config.test_compare_mode, test_compare_mode);
|
||||||
set(&mut config.backtrace, backtrace);
|
set(&mut config.backtrace, backtrace);
|
||||||
config.description = description;
|
if rust_description.is_some() {
|
||||||
|
eprintln!(
|
||||||
|
"Warning: rust.description is deprecated. Use build.description instead."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
description = description.or(rust_description);
|
||||||
set(&mut config.rust_dist_src, dist_src);
|
set(&mut config.rust_dist_src, dist_src);
|
||||||
set(&mut config.verbose_tests, verbose_tests);
|
set(&mut config.verbose_tests, verbose_tests);
|
||||||
// in the case "false" is set explicitly, do not overwrite the command line args
|
// in the case "false" is set explicitly, do not overwrite the command line args
|
||||||
|
@ -1990,6 +1998,7 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
config.reproducible_artifacts = flags.reproducible_artifact;
|
config.reproducible_artifacts = flags.reproducible_artifact;
|
||||||
|
config.description = description;
|
||||||
|
|
||||||
// We need to override `rust.channel` if it's manually specified when using the CI rustc.
|
// We need to override `rust.channel` if it's manually specified when using the CI rustc.
|
||||||
// This is because if the compiler uses a different channel than the one specified in config.toml,
|
// This is because if the compiler uses a different channel than the one specified in config.toml,
|
||||||
|
|
|
@ -365,4 +365,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
|
||||||
severity: ChangeSeverity::Info,
|
severity: ChangeSeverity::Info,
|
||||||
summary: "`rust.channel` now supports \"auto-detect\" to load the channel from `src/ci/channel`",
|
summary: "`rust.channel` now supports \"auto-detect\" to load the channel from `src/ci/channel`",
|
||||||
},
|
},
|
||||||
|
ChangeInfo {
|
||||||
|
change_id: 137723,
|
||||||
|
severity: ChangeSeverity::Info,
|
||||||
|
summary: "The rust.description option has moved to build.description and rust.description is now deprecated.",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue