Skip to content

Commit 5b8b787

Browse files
author
default
committed
rename config.toml to bootstrap.toml
1 parent f4831e6 commit 5b8b787

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+336
-315
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file should only ignore things that are generated during a `x.py` build,
22
# generated by common IDEs, and optional files controlled by the user that
3-
# affect the build (such as config.toml).
3+
# affect the build (such as bootstrap.toml).
44
# In particular, things like `mir_dump` should not be listed here; they are only
55
# created during manual debugging and many people like to clean up instead of
66
# having git ignore such leftovers. You can use `.git/info/exclude` to
@@ -30,6 +30,7 @@ Session.vim
3030
!/tests/run-make/thumb-none-qemu/example/.cargo
3131

3232
## Configuration
33+
/bootstrap.toml
3334
/config.toml
3435
/Makefile
3536
config.mk

.ignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# Make vscode *not* count `config.toml` as ignored, so it is included in search
1+
# Make vscode *not* count `bootstrap.toml` and `config.toml` as ignored, so it is included in search
2+
!/bootstrap.toml
23
!/config.toml

INSTALL.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ If you just want to install Rust, check out the [README.md](README.md) instead.*
66

77
The Rust build system uses a Python script called `x.py` to build the compiler,
88
which manages the bootstrapping process. It lives at the root of the project.
9-
It also uses a file named `config.toml` to determine various configuration
9+
It also uses a file named `bootstrap.toml` to determine various configuration
1010
settings for the build. You can see a full list of options in
11-
`config.example.toml`.
11+
`bootstrap.example.toml`.
1212

1313
The `x.py` command can be run directly on most Unix systems in the following
1414
format:
@@ -101,15 +101,15 @@ See [the rustc-dev-guide for more info][sysllvm].
101101

102102
This project provides a configure script and makefile (the latter of which just
103103
invokes `x.py`). `./configure` is the recommended way to programmatically
104-
generate a `config.toml`. `make` is not recommended (we suggest using `x.py`
104+
generate a `bootstrap.toml`. `make` is not recommended (we suggest using `x.py`
105105
directly), but it is supported and we try not to break it unnecessarily.
106106

107107
```sh
108108
./configure
109109
make && sudo make install
110110
```
111111

112-
`configure` generates a `config.toml` which can also be used with normal `x.py`
112+
`configure` generates a `bootstrap.toml` which can also be used with normal `x.py`
113113
invocations.
114114

115115
## Building on Windows
@@ -237,7 +237,7 @@ Windows build triples are:
237237
- `x86_64-pc-windows-msvc`
238238

239239
The build triple can be specified by either specifying `--build=<triple>` when
240-
invoking `x.py` commands, or by creating a `config.toml` file (as described in
240+
invoking `x.py` commands, or by creating a `bootstrap.toml` file (as described in
241241
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing
242242
`--set build.build=<triple>` to `./configure`.
243243

REUSE.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = [
2222
"Cargo.lock",
2323
"Cargo.toml",
2424
"CODE_OF_CONDUCT.md",
25-
"config.example.toml",
25+
"bootstrap.example.toml",
2626
"configure",
2727
"CONTRIBUTING.md",
2828
"COPYRIGHT",

config.example.toml renamed to bootstrap.example.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# All options are commented out by default in this file, and they're commented
77
# out with their default values. The build system by default looks for
8-
# `config.toml` in the current directory of a build for build configuration, but
8+
# `bootstrap.toml` in the current directory of a build for build configuration, but
99
# a custom configuration file can also be specified with `--config` to the build
1010
# system.
1111

@@ -16,7 +16,7 @@
1616
# Use different pre-set defaults than the global defaults.
1717
#
1818
# See `src/bootstrap/defaults` for more information.
19-
# Note that this has no default value (x.py uses the defaults in `config.example.toml`).
19+
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
2020
#profile = <none>
2121

2222
# Keeps track of major changes made to this configuration.
@@ -311,7 +311,7 @@
311311
# Enable a build of the extended Rust tool set which is not only the compiler
312312
# but also tools such as Cargo. This will also produce "combined installers"
313313
# which are used to install Rust and Cargo together.
314-
# The `tools` (check `config.example.toml` to see its default value) option specifies
314+
# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies
315315
# which tools should be built if `extended = true`.
316316
#
317317
# This is disabled by default.

src/bootstrap/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ compiler, which will then build the bootstrap binary written in Rust.
163163

164164
Because there are two separate codebases behind `x.py`, they need to
165165
be kept in sync. In particular, both `bootstrap.py` and the bootstrap binary
166-
parse `config.toml` and read the same command line arguments. `bootstrap.py`
166+
parse `bootstrap.toml` and read the same command line arguments. `bootstrap.py`
167167
keeps these in sync by setting various environment variables, and the
168168
programs sometimes have to add arguments that are explicitly ignored, to be
169169
read by the other.
@@ -185,7 +185,7 @@ Some general areas that you may be interested in modifying are:
185185
If you make a major change on bootstrap configuration, please remember to:
186186

187187
+ Update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/utils/change_tracker.rs`.
188-
* Update `change-id = {pull-request-id}` in `config.example.toml`.
188+
* Update `change-id = {pull-request-id}` in `bootstrap.example.toml`.
189189

190190
A 'major change' includes
191191

src/bootstrap/bootstrap.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ def download_toolchain(self):
635635

636636
def should_fix_bins_and_dylibs(self):
637637
"""Whether or not `fix_bin_or_dylib` needs to be run; can only be True
638-
on NixOS or if config.toml has `build.patch-binaries-for-nix` set.
638+
on NixOS or if bootstrap.toml has `build.patch-binaries-for-nix` set.
639639
"""
640640
if self._should_fix_bins_and_dylibs is not None:
641641
return self._should_fix_bins_and_dylibs
@@ -676,7 +676,7 @@ def get_answer():
676676
in_nix_shell = os.getenv('IN_NIX_SHELL')
677677
if in_nix_shell:
678678
eprint("The IN_NIX_SHELL environment variable is `{}`;".format(in_nix_shell),
679-
"you may need to set `patch-binaries-for-nix=true` in config.toml")
679+
"you may need to set `patch-binaries-for-nix=true` in bootstrap.toml")
680680

681681
return is_nixos
682682

@@ -778,7 +778,7 @@ def bin_root(self):
778778
return os.path.join(self.build_dir, self.build, subdir)
779779

780780
def get_toml(self, key, section=None):
781-
"""Returns the value of the given key in config.toml, otherwise returns None
781+
"""Returns the value of the given key in bootstrap.toml, otherwise returns None
782782
783783
>>> rb = RustBuild()
784784
>>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"'
@@ -1107,17 +1107,21 @@ def bootstrap(args):
11071107
"git clone nor distributed tarball.\nThis build may fail due to missing submodules "
11081108
"unless you put them in place manually.")
11091109

1110-
# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`,
1111-
# then `config.toml` in the root directory.
1110+
# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./bootstrap.toml` or
1111+
# `./config.toml`, then `bootstrap.toml` or `config.toml` in the root directory.
11121112
toml_path = args.config or os.getenv('RUST_BOOTSTRAP_CONFIG')
11131113
using_default_path = toml_path is None
11141114
if using_default_path:
1115-
toml_path = 'config.toml'
1115+
toml_path = 'bootstrap.toml'
11161116
if not os.path.exists(toml_path):
1117-
toml_path = os.path.join(rust_root, toml_path)
1117+
toml_path = 'config.toml'
1118+
if not os.path.exists(toml_path):
1119+
toml_path = os.path.join(rust_root, 'bootstrap.toml')
1120+
if not os.path.exists(toml_path):
1121+
toml_path = os.path.join(rust_root, 'config.toml')
11181122

11191123
# Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
1120-
# but not if `config.toml` hasn't been created.
1124+
# but not if `bootstrap.toml` hasn't been created.
11211125
if not using_default_path or os.path.exists(toml_path):
11221126
with open(toml_path) as config:
11231127
config_toml = config.read()
@@ -1132,7 +1136,7 @@ def bootstrap(args):
11321136
profile_aliases = {
11331137
"user": "dist"
11341138
}
1135-
include_file = 'config.{}.toml'.format(profile_aliases.get(profile) or profile)
1139+
include_file = 'bootstrap.{}.toml'.format(profile_aliases.get(profile) or profile)
11361140
include_dir = os.path.join(rust_root, 'src', 'bootstrap', 'defaults')
11371141
include_path = os.path.join(include_dir, include_file)
11381142

src/bootstrap/bootstrap_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_same_dates(self):
100100

101101

102102
class GenerateAndParseConfig(unittest.TestCase):
103-
"""Test that we can serialize and deserialize a config.toml file"""
103+
"""Test that we can serialize and deserialize a bootstrap.toml file"""
104104
def test_no_args(self):
105105
build = serialize_and_parse([])
106106
self.assertEqual(build.get_toml("profile"), 'dist')
@@ -143,11 +143,11 @@ def build_args(self, configure_args=None, args=None, env=None):
143143
# problem in most cases, but there is a scenario where it would cause
144144
# the test to fail.
145145
#
146-
# When a custom local Cargo is configured in config.toml (with the
146+
# When a custom local Cargo is configured in bootstrap.toml (with the
147147
# build.cargo setting), no Cargo is downloaded to any location known by
148148
# bootstrap, and bootstrap relies on that setting to find it.
149149
#
150-
# In this test though we are not using the config.toml of the caller:
150+
# In this test though we are not using the bootstrap.toml of the caller:
151151
# we are generating a blank one instead. If we don't set build.cargo in
152152
# it, the test will have no way to find Cargo, failing the test.
153153
cargo_bin = os.environ.get("BOOTSTRAP_TEST_CARGO_BIN")

src/bootstrap/configure.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ def is_value_list(key):
195195
print('\t{:30} {}'.format('--enable-{}'.format(option.name), option.desc))
196196
print('')
197197
print('This configure script is a thin configuration shim over the true')
198-
print('configuration system, `config.toml`. You can explore the comments')
199-
print('in `config.example.toml` next to this configure script to see')
198+
print('configuration system, `bootstrap.toml`. You can explore the comments')
199+
print('in `bootstrap.example.toml` next to this configure script to see')
200200
print('more information about what each option is. Additionally you can')
201201
print('pass `--set` as an argument to set arbitrary key/value pairs')
202202
print('in the TOML configuration if desired')
@@ -381,8 +381,8 @@ def apply_args(known_args, option_checking, config):
381381
else:
382382
raise RuntimeError("unhandled option {}".format(option.name))
383383

384-
# "Parse" the `config.example.toml` file into the various sections, and we'll
385-
# use this as a template of a `config.toml` to write out which preserves
384+
# "Parse" the `bootstrap.example.toml` file into the various sections, and we'll
385+
# use this as a template of a `bootstrap.toml` to write out which preserves
386386
# all the various comments and whatnot.
387387
#
388388
# Note that the `target` section is handled separately as we'll duplicate it
@@ -395,7 +395,7 @@ def parse_example_config(known_args, config):
395395
targets = {}
396396
top_level_keys = []
397397

398-
with open(rust_dir + '/config.example.toml') as example_config:
398+
with open(rust_dir + '/bootstrap.example.toml') as example_config:
399399
example_lines = example_config.read().split("\n")
400400
for line in example_lines:
401401
if cur_section is None:
@@ -549,7 +549,8 @@ def quit_if_file_exists(file):
549549
err(msg)
550550

551551
if __name__ == "__main__":
552-
# If 'config.toml' already exists, exit the script at this point
552+
# If 'bootstrap.toml' or 'config.toml' already exists, exit the script at this point
553+
quit_if_file_exists('bootstrap.toml')
553554
quit_if_file_exists('config.toml')
554555

555556
if "GITHUB_ACTIONS" in os.environ:
@@ -563,8 +564,8 @@ def quit_if_file_exists(file):
563564
# Now that we've built up our `config.toml`, write it all out in the same
564565
# order that we read it in.
565566
p("")
566-
p("writing `config.toml` in current directory")
567-
with bootstrap.output('config.toml') as f:
567+
p("writing `bootstrap.toml` in current directory")
568+
with bootstrap.output('bootstrap.toml') as f:
568569
write_config_toml(f, section_order, targets, sections)
569570

570571
with bootstrap.output('Makefile') as f:

src/bootstrap/src/bin/main.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ fn main() {
5959
let changelog_suggestion =
6060
if matches!(config.cmd, Subcommand::Setup { .. }) { None } else { check_version(&config) };
6161

62-
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
62+
// NOTE: Since `./configure` generates a `bootstrap.toml`, distro maintainers will see the
6363
// changelog warning, not the `x.py setup` message.
6464
let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. });
6565
if suggest_setup {
66-
println!("WARNING: you have not made a `config.toml`");
66+
println!("WARNING: you have not made a `bootstrap.toml`");
6767
println!(
68-
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
69-
`cp config.example.toml config.toml`"
68+
"HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \
69+
`cp bootstrap.example.toml bootstrap.toml`"
7070
);
7171
} else if let Some(suggestion) = &changelog_suggestion {
7272
println!("{suggestion}");
@@ -79,10 +79,10 @@ fn main() {
7979
Build::new(config).build();
8080

8181
if suggest_setup {
82-
println!("WARNING: you have not made a `config.toml`");
82+
println!("WARNING: you have not made a `bootstrap.toml`");
8383
println!(
84-
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
85-
`cp config.example.toml config.toml`"
84+
"HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \
85+
`cp bootstrap.example.toml bootstrap.toml`"
8686
);
8787
} else if let Some(suggestion) = &changelog_suggestion {
8888
println!("{suggestion}");
@@ -141,7 +141,7 @@ fn check_version(config: &Config) -> Option<String> {
141141
}
142142

143143
// Always try to use `change-id` from .last-warned-change-id first. If it doesn't exist,
144-
// then use the one from the config.toml. This way we never show the same warnings
144+
// then use the one from the bootstrap.toml. This way we never show the same warnings
145145
// more than once.
146146
if let Ok(t) = fs::read_to_string(&warned_id_path) {
147147
let last_warned_id = usize::from_str(&t)
@@ -166,16 +166,18 @@ fn check_version(config: &Config) -> Option<String> {
166166

167167
msg.push_str("NOTE: to silence this warning, ");
168168
msg.push_str(&format!(
169-
"update `config.toml` to use `change-id = {latest_change_id}` instead"
169+
"update `bootstrap.toml` to use `change-id = {latest_change_id}` instead"
170170
));
171171

172172
if io::stdout().is_terminal() && !config.dry_run() {
173173
t!(fs::write(warned_id_path, latest_change_id.to_string()));
174174
}
175175
} else {
176-
msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");
176+
msg.push_str("WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");
177177
msg.push_str("NOTE: to silence this warning, ");
178-
msg.push_str(&format!("add `change-id = {latest_change_id}` at the top of `config.toml`"));
178+
msg.push_str(&format!(
179+
"add `change-id = {latest_change_id}` at the top of `bootstrap.toml`"
180+
));
179181
};
180182

181183
Some(msg)

src/bootstrap/src/core/build_steps/compile.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ fn copy_self_contained_objects(
397397
} else if target.contains("-wasi") {
398398
let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
399399
panic!(
400-
"Target {:?} does not have a \"wasi-root\" key in Config.toml \
400+
"Target {:?} does not have a \"wasi-root\" key in bootstrap.toml \
401401
or `$WASI_SDK_PATH` set",
402402
target.triple
403403
)
@@ -1081,7 +1081,7 @@ pub fn rustc_cargo_env(
10811081
.env("CFG_VERSION", builder.rust_version());
10821082

10831083
// Some tools like Cargo detect their own git information in build scripts. When omit-git-hash
1084-
// is enabled in config.toml, we pass this environment variable to tell build scripts to avoid
1084+
// is enabled in bootstrap.toml, we pass this environment variable to tell build scripts to avoid
10851085
// detecting git information on their own.
10861086
if builder.config.omit_git_hash {
10871087
cargo.env("CFG_OMIT_GIT_HASH", "1");
@@ -1288,7 +1288,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
12881288
{
12891289
run.builder.info(
12901290
"WARNING: no codegen-backends config matched the requested path to build a codegen backend. \
1291-
HELP: add backend to codegen-backends in config.toml.",
1291+
HELP: add backend to codegen-backends in bootstrap.toml.",
12921292
);
12931293
return true;
12941294
}
@@ -1300,7 +1300,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
13001300
impl Step for CodegenBackend {
13011301
type Output = ();
13021302
const ONLY_HOSTS: bool = true;
1303-
/// Only the backends specified in the `codegen-backends` entry of `config.toml` are built.
1303+
/// Only the backends specified in the `codegen-backends` entry of `bootstrap.toml` are built.
13041304
const DEFAULT: bool = true;
13051305

13061306
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {

src/bootstrap/src/core/build_steps/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ impl Step for PlainSourceTarball {
986986
"RELEASES.md",
987987
"configure",
988988
"x.py",
989-
"config.example.toml",
989+
"bootstrap.example.toml",
990990
"Cargo.toml",
991991
"Cargo.lock",
992992
".gitmodules",

src/bootstrap/src/core/build_steps/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ impl Step for RustcBook {
12081208
cmd.env("RUSTC_BOOTSTRAP", "1");
12091209

12101210
// If the lib directories are in an unusual location (changed in
1211-
// config.toml), then this needs to explicitly update the dylib search
1211+
// bootstrap.toml), then this needs to explicitly update the dylib search
12121212
// path.
12131213
builder.add_rustc_lib_path(self.compiler, &mut cmd);
12141214
let doc_generator_guard = builder.msg(

src/bootstrap/src/core/build_steps/install.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ fn install_sh(
8585
} else {
8686
assert!(
8787
is_dir_writable_for_user(&prefix),
88-
"User doesn't have write access on `install.prefix` path in the `config.toml`.",
88+
"User doesn't have write access on `install.prefix` path in the `bootstrap.toml`.",
8989
);
9090
assert!(
9191
is_dir_writable_for_user(&sysconfdir),
92-
"User doesn't have write access on `install.sysconfdir` path in `config.toml`."
92+
"User doesn't have write access on `install.sysconfdir` path in `bootstrap.toml`."
9393
);
9494
}
9595

src/bootstrap/src/core/build_steps/llvm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl Step for Llvm {
312312
(true, true) => "RelWithDebInfo",
313313
};
314314

315-
// NOTE: remember to also update `config.example.toml` when changing the
315+
// NOTE: remember to also update `bootstrap.example.toml` when changing the
316316
// defaults!
317317
let llvm_targets = match &builder.config.llvm_targets {
318318
Some(s) => s,

0 commit comments

Comments
 (0)