Skip to content

Commit 17f69bf

Browse files
committed
Rename tool-config to tool and add docs
1 parent 8dac423 commit 17f69bf

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

bootstrap.example.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,13 @@
382382
#]
383383

384384
# Specify build configuration specific for some tool, such as enabled features.
385+
# This option has no effect on which tools are enabled: refer to the `tools` option for that.
385386
#
386-
# For example, to build Miri with tracing support, use `tool-config.miri.features = ["tracing"]`
387+
# For example, to build Miri with tracing support, use `tool.miri.features = ["tracing"]`
387388
#
388389
# The default value for the `features` array is `[]`. However, please note that other flags in
389390
# `bootstrap.toml` might influence the features enabled for some tools.
390-
#tool-config.TOOL_NAME.features = [FEATURE1, FEATURE2]
391+
#tool.TOOL_NAME.features = [FEATURE1, FEATURE2]
391392

392393
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose, 3 == print environment variables on each rustc invocation
393394
#verbose = 0

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,16 @@ impl Step for ToolBuild {
136136
_ => panic!("unexpected Mode for tool build"),
137137
}
138138

139-
// build.tool-config.TOOL_NAME.features in bootstrap.toml allows specifying which features
140-
// to enable for a specific tool. `extra_features` instead is not controlled by the toml
141-
// instead provides features that are always enabled for a specific tool (e.g.
142-
// "in-rust-tree" for rust-analyzer). Finally, `prepare_tool_cargo` might add more features
143-
// to adapt the build to the chosen flags (e.g. "all-static" for cargo if
144-
// `cargo_native_static` is true).
139+
// build.tool.TOOL_NAME.features in bootstrap.toml allows specifying which features to
140+
// enable for a specific tool. `extra_features` instead is not controlled by the toml and
141+
// provides features that are always enabled for a specific tool (e.g. "in-rust-tree" for
142+
// rust-analyzer). Finally, `prepare_tool_cargo` might add more features to adapt the build
143+
// to the chosen flags (e.g. "all-static" for cargo if `cargo_native_static` is true).
145144
let mut features = builder
146145
.config
147-
.tool_config
146+
.tool
148147
.get(self.tool)
149-
.and_then(|tool_config| tool_config.features.clone())
148+
.and_then(|tool| tool.features.clone())
150149
.unwrap_or_default();
151150
features.extend(self.extra_features.clone());
152151

src/bootstrap/src/core/config/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub use crate::core::config::flags::Subcommand;
3535
use crate::core::config::flags::{Color, Flags};
3636
use crate::core::config::target_selection::TargetSelectionList;
3737
use crate::core::config::toml::TomlConfig;
38-
use crate::core::config::toml::build::{Build, ToolConfig};
38+
use crate::core::config::toml::build::{Build, Tool};
3939
use crate::core::config::toml::change_id::ChangeId;
4040
use crate::core::config::toml::rust::{
4141
LldMode, RustOptimize, check_incompatible_options_for_ci_rustc,
@@ -114,7 +114,9 @@ pub struct Config {
114114
pub bootstrap_cache_path: Option<PathBuf>,
115115
pub extended: bool,
116116
pub tools: Option<HashSet<String>>,
117-
pub tool_config: HashMap<String, ToolConfig>,
117+
/// Specify build configuration specific for some tool, such as enabled features, see [Tool].
118+
/// The key in the map is the name of the tool, and the value is tool-specific configuration.
119+
pub tool: HashMap<String, Tool>,
118120
pub sanitizers: bool,
119121
pub profiler: bool,
120122
pub omit_git_hash: bool,
@@ -690,7 +692,7 @@ impl Config {
690692
bootstrap_cache_path,
691693
extended,
692694
tools,
693-
tool_config,
695+
tool,
694696
verbose,
695697
sanitizers,
696698
profiler,
@@ -837,7 +839,7 @@ impl Config {
837839
set(&mut config.full_bootstrap, full_bootstrap);
838840
set(&mut config.extended, extended);
839841
config.tools = tools;
840-
set(&mut config.tool_config, tool_config);
842+
set(&mut config.tool, tool);
841843
set(&mut config.verbose, verbose);
842844
set(&mut config.sanitizers, sanitizers);
843845
set(&mut config.profiler, profiler);

src/bootstrap/src/core/config/toml/build.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ define_config! {
4444
bootstrap_cache_path: Option<PathBuf> = "bootstrap-cache-path",
4545
extended: Option<bool> = "extended",
4646
tools: Option<HashSet<String>> = "tools",
47-
tool_config: Option<HashMap<String, ToolConfig>> = "tool-config",
47+
tool: Option<HashMap<String, Tool>> = "tool",
4848
verbose: Option<usize> = "verbose",
4949
sanitizers: Option<bool> = "sanitizers",
5050
profiler: Option<bool> = "profiler",
@@ -75,8 +75,9 @@ define_config! {
7575
}
7676

7777
define_config! {
78+
/// Configuration specific for some tool, e.g. which features to enable during build.
7879
#[derive(Default, Clone)]
79-
struct ToolConfig {
80+
struct Tool {
8081
features: Option<Vec<String>> = "features",
8182
}
8283
}

src/bootstrap/src/utils/change_tracker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,6 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
424424
ChangeInfo {
425425
change_id: 142379,
426426
severity: ChangeSeverity::Info,
427-
summary: "Added new option `tool-config.TOOL_NAME.features` to specify the features to compile a tool with",
427+
summary: "Added new option `tool.TOOL_NAME.features` to specify the features to compile a tool with",
428428
},
429429
];

0 commit comments

Comments
 (0)