Rename tool-config to tool and add docs

This commit is contained in:
Stypox
2025-06-12 13:53:22 +02:00
parent 8dac423f82
commit 17f69bfda0
5 changed files with 20 additions and 17 deletions

View File

@@ -382,12 +382,13 @@
#] #]
# Specify build configuration specific for some tool, such as enabled features. # Specify build configuration specific for some tool, such as enabled features.
# This option has no effect on which tools are enabled: refer to the `tools` option for that.
# #
# For example, to build Miri with tracing support, use `tool-config.miri.features = ["tracing"]` # For example, to build Miri with tracing support, use `tool.miri.features = ["tracing"]`
# #
# The default value for the `features` array is `[]`. However, please note that other flags in # The default value for the `features` array is `[]`. However, please note that other flags in
# `bootstrap.toml` might influence the features enabled for some tools. # `bootstrap.toml` might influence the features enabled for some tools.
#tool-config.TOOL_NAME.features = [FEATURE1, FEATURE2] #tool.TOOL_NAME.features = [FEATURE1, FEATURE2]
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose, 3 == print environment variables on each rustc invocation # Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose, 3 == print environment variables on each rustc invocation
#verbose = 0 #verbose = 0

View File

@@ -136,17 +136,16 @@ impl Step for ToolBuild {
_ => panic!("unexpected Mode for tool build"), _ => panic!("unexpected Mode for tool build"),
} }
// build.tool-config.TOOL_NAME.features in bootstrap.toml allows specifying which features // build.tool.TOOL_NAME.features in bootstrap.toml allows specifying which features to
// to enable for a specific tool. `extra_features` instead is not controlled by the toml // enable for a specific tool. `extra_features` instead is not controlled by the toml and
// instead provides features that are always enabled for a specific tool (e.g. // provides features that are always enabled for a specific tool (e.g. "in-rust-tree" for
// "in-rust-tree" for rust-analyzer). Finally, `prepare_tool_cargo` might add more features // rust-analyzer). Finally, `prepare_tool_cargo` might add more features to adapt the build
// to adapt the build to the chosen flags (e.g. "all-static" for cargo if // to the chosen flags (e.g. "all-static" for cargo if `cargo_native_static` is true).
// `cargo_native_static` is true).
let mut features = builder let mut features = builder
.config .config
.tool_config .tool
.get(self.tool) .get(self.tool)
.and_then(|tool_config| tool_config.features.clone()) .and_then(|tool| tool.features.clone())
.unwrap_or_default(); .unwrap_or_default();
features.extend(self.extra_features.clone()); features.extend(self.extra_features.clone());

View File

@@ -35,7 +35,7 @@ pub use crate::core::config::flags::Subcommand;
use crate::core::config::flags::{Color, Flags}; use crate::core::config::flags::{Color, Flags};
use crate::core::config::target_selection::TargetSelectionList; use crate::core::config::target_selection::TargetSelectionList;
use crate::core::config::toml::TomlConfig; use crate::core::config::toml::TomlConfig;
use crate::core::config::toml::build::{Build, ToolConfig}; use crate::core::config::toml::build::{Build, Tool};
use crate::core::config::toml::change_id::ChangeId; use crate::core::config::toml::change_id::ChangeId;
use crate::core::config::toml::rust::{ use crate::core::config::toml::rust::{
LldMode, RustOptimize, check_incompatible_options_for_ci_rustc, LldMode, RustOptimize, check_incompatible_options_for_ci_rustc,
@@ -114,7 +114,9 @@ pub struct Config {
pub bootstrap_cache_path: Option<PathBuf>, pub bootstrap_cache_path: Option<PathBuf>,
pub extended: bool, pub extended: bool,
pub tools: Option<HashSet<String>>, pub tools: Option<HashSet<String>>,
pub tool_config: HashMap<String, ToolConfig>, /// Specify build configuration specific for some tool, such as enabled features, see [Tool].
/// The key in the map is the name of the tool, and the value is tool-specific configuration.
pub tool: HashMap<String, Tool>,
pub sanitizers: bool, pub sanitizers: bool,
pub profiler: bool, pub profiler: bool,
pub omit_git_hash: bool, pub omit_git_hash: bool,
@@ -690,7 +692,7 @@ impl Config {
bootstrap_cache_path, bootstrap_cache_path,
extended, extended,
tools, tools,
tool_config, tool,
verbose, verbose,
sanitizers, sanitizers,
profiler, profiler,
@@ -837,7 +839,7 @@ impl Config {
set(&mut config.full_bootstrap, full_bootstrap); set(&mut config.full_bootstrap, full_bootstrap);
set(&mut config.extended, extended); set(&mut config.extended, extended);
config.tools = tools; config.tools = tools;
set(&mut config.tool_config, tool_config); set(&mut config.tool, tool);
set(&mut config.verbose, verbose); set(&mut config.verbose, verbose);
set(&mut config.sanitizers, sanitizers); set(&mut config.sanitizers, sanitizers);
set(&mut config.profiler, profiler); set(&mut config.profiler, profiler);

View File

@@ -44,7 +44,7 @@ define_config! {
bootstrap_cache_path: Option<PathBuf> = "bootstrap-cache-path", bootstrap_cache_path: Option<PathBuf> = "bootstrap-cache-path",
extended: Option<bool> = "extended", extended: Option<bool> = "extended",
tools: Option<HashSet<String>> = "tools", tools: Option<HashSet<String>> = "tools",
tool_config: Option<HashMap<String, ToolConfig>> = "tool-config", tool: Option<HashMap<String, Tool>> = "tool",
verbose: Option<usize> = "verbose", verbose: Option<usize> = "verbose",
sanitizers: Option<bool> = "sanitizers", sanitizers: Option<bool> = "sanitizers",
profiler: Option<bool> = "profiler", profiler: Option<bool> = "profiler",
@@ -75,8 +75,9 @@ define_config! {
} }
define_config! { define_config! {
/// Configuration specific for some tool, e.g. which features to enable during build.
#[derive(Default, Clone)] #[derive(Default, Clone)]
struct ToolConfig { struct Tool {
features: Option<Vec<String>> = "features", features: Option<Vec<String>> = "features",
} }
} }

View File

@@ -424,6 +424,6 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
ChangeInfo { ChangeInfo {
change_id: 142379, change_id: 142379,
severity: ChangeSeverity::Info, severity: ChangeSeverity::Info,
summary: "Added new option `tool-config.TOOL_NAME.features` to specify the features to compile a tool with", summary: "Added new option `tool.TOOL_NAME.features` to specify the features to compile a tool with",
}, },
]; ];