change config.toml to bootstrap.toml for bootstrap module
This commit is contained in:
parent
10bcdad7df
commit
1954494ec9
37 changed files with 144 additions and 116 deletions
2
.github/ISSUE_TEMPLATE/bootstrap.md
vendored
2
.github/ISSUE_TEMPLATE/bootstrap.md
vendored
|
@ -32,7 +32,7 @@ Describe what you expected to happen.
|
||||||
Describe what actually happened.
|
Describe what actually happened.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
### Bootstrap configuration (config.toml)
|
### Bootstrap configuration (bootstrap.toml)
|
||||||
```toml
|
```toml
|
||||||
<config>
|
<config>
|
||||||
```
|
```
|
||||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
# This file should only ignore things that are generated during a `x.py` build,
|
# This file should only ignore things that are generated during a `x.py` build,
|
||||||
# generated by common IDEs, and optional files controlled by the user that
|
# generated by common IDEs, and optional files controlled by the user that
|
||||||
# affect the build (such as config.toml).
|
# affect the build (such as bootstrap.toml).
|
||||||
# In particular, things like `mir_dump` should not be listed here; they are only
|
# In particular, things like `mir_dump` should not be listed here; they are only
|
||||||
# created during manual debugging and many people like to clean up instead of
|
# created during manual debugging and many people like to clean up instead of
|
||||||
# having git ignore such leftovers. You can use `.git/info/exclude` to
|
# having git ignore such leftovers. You can use `.git/info/exclude` to
|
||||||
|
@ -34,6 +34,7 @@ Session.vim
|
||||||
!/tests/run-make/thumb-none-qemu/example/.cargo
|
!/tests/run-make/thumb-none-qemu/example/.cargo
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
/bootstrap.toml
|
||||||
/config.toml
|
/config.toml
|
||||||
/Makefile
|
/Makefile
|
||||||
config.mk
|
config.mk
|
||||||
|
|
3
.ignore
3
.ignore
|
@ -1,2 +1,3 @@
|
||||||
# Make vscode *not* count `config.toml` as ignored, so it is included in search
|
# Make vscode *not* count `bootstrap.toml` and `config.toml` as ignored, so it is included in search
|
||||||
|
!/bootstrap.toml
|
||||||
!/config.toml
|
!/config.toml
|
||||||
|
|
10
INSTALL.md
10
INSTALL.md
|
@ -6,9 +6,9 @@ If you just want to install Rust, check out the [README.md](README.md) instead.*
|
||||||
|
|
||||||
The Rust build system uses a Python script called `x.py` to build the compiler,
|
The Rust build system uses a Python script called `x.py` to build the compiler,
|
||||||
which manages the bootstrapping process. It lives at the root of the project.
|
which manages the bootstrapping process. It lives at the root of the project.
|
||||||
It also uses a file named `config.toml` to determine various configuration
|
It also uses a file named `bootstrap.toml` to determine various configuration
|
||||||
settings for the build. You can see a full list of options in
|
settings for the build. You can see a full list of options in
|
||||||
`config.example.toml`.
|
`bootstrap.example.toml`.
|
||||||
|
|
||||||
The `x.py` command can be run directly on most Unix systems in the following
|
The `x.py` command can be run directly on most Unix systems in the following
|
||||||
format:
|
format:
|
||||||
|
@ -115,7 +115,7 @@ See [the rustc-dev-guide for more info][sysllvm].
|
||||||
|
|
||||||
This project provides a configure script and makefile (the latter of which just
|
This project provides a configure script and makefile (the latter of which just
|
||||||
invokes `x.py`). `./configure` is the recommended way to programmatically
|
invokes `x.py`). `./configure` is the recommended way to programmatically
|
||||||
generate a `config.toml`. `make` is not recommended (we suggest using `x.py`
|
generate a `bootstrap.toml`. `make` is not recommended (we suggest using `x.py`
|
||||||
directly), but it is supported and we try not to break it unnecessarily.
|
directly), but it is supported and we try not to break it unnecessarily.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -123,7 +123,7 @@ directly), but it is supported and we try not to break it unnecessarily.
|
||||||
make && sudo make install
|
make && sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
`configure` generates a `config.toml` which can also be used with normal `x.py`
|
`configure` generates a `bootstrap.toml` which can also be used with normal `x.py`
|
||||||
invocations.
|
invocations.
|
||||||
|
|
||||||
## Building on Windows
|
## Building on Windows
|
||||||
|
@ -255,7 +255,7 @@ Windows build triples are:
|
||||||
- `x86_64-pc-windows-msvc`
|
- `x86_64-pc-windows-msvc`
|
||||||
|
|
||||||
The build triple can be specified by either specifying `--build=<triple>` when
|
The build triple can be specified by either specifying `--build=<triple>` when
|
||||||
invoking `x.py` commands, or by creating a `config.toml` file (as described in
|
invoking `x.py` commands, or by creating a `bootstrap.toml` file (as described in
|
||||||
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing
|
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing
|
||||||
`--set build.build=<triple>` to `./configure`.
|
`--set build.build=<triple>` to `./configure`.
|
||||||
|
|
||||||
|
|
|
@ -2282,7 +2282,7 @@ Compatibility Notes
|
||||||
- [Cargo denies `CARGO_HOME` in the `[env]` configuration table. Cargo itself doesn't pick up this value, but recursive calls to cargo would, which was not intended.](https://github.com/rust-lang/cargo/pull/11644/)
|
- [Cargo denies `CARGO_HOME` in the `[env]` configuration table. Cargo itself doesn't pick up this value, but recursive calls to cargo would, which was not intended.](https://github.com/rust-lang/cargo/pull/11644/)
|
||||||
- [Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.](https://github.com/rust-lang/cargo/pull/11252/)
|
- [Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.](https://github.com/rust-lang/cargo/pull/11252/)
|
||||||
- [The Rust distribution no longer always includes rustdoc](https://github.com/rust-lang/rust/pull/106886)
|
- [The Rust distribution no longer always includes rustdoc](https://github.com/rust-lang/rust/pull/106886)
|
||||||
If `tools = [...]` is set in config.toml, we will respect a missing rustdoc in that list. By
|
If `tools = [...]` is set in bootstrap.toml, we will respect a missing rustdoc in that list. By
|
||||||
default rustdoc remains included. To retain the prior behavior explicitly add `"rustdoc"` to the
|
default rustdoc remains included. To retain the prior behavior explicitly add `"rustdoc"` to the
|
||||||
list.
|
list.
|
||||||
|
|
||||||
|
@ -5268,7 +5268,7 @@ related tools.
|
||||||
|
|
||||||
- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
|
- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
|
||||||
You can continue building with `make` by setting `ninja=false` in
|
You can continue building with `make` by setting `ninja=false` in
|
||||||
your `config.toml`.
|
your `bootstrap.toml`.
|
||||||
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
|
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
|
||||||
- [Made `ensure_sufficient_stack()` non-generic][76680]
|
- [Made `ensure_sufficient_stack()` non-generic][76680]
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ path = [
|
||||||
"Cargo.lock",
|
"Cargo.lock",
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
"CODE_OF_CONDUCT.md",
|
"CODE_OF_CONDUCT.md",
|
||||||
"config.example.toml",
|
"bootstrap.example.toml",
|
||||||
"configure",
|
"configure",
|
||||||
"CONTRIBUTING.md",
|
"CONTRIBUTING.md",
|
||||||
"COPYRIGHT",
|
"COPYRIGHT",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
# All options are commented out by default in this file, and they're commented
|
# All options are commented out by default in this file, and they're commented
|
||||||
# out with their default values. The build system by default looks for
|
# out with their default values. The build system by default looks for
|
||||||
# `config.toml` in the current directory of a build for build configuration, but
|
# `bootstrap.toml` in the current directory of a build for build configuration, but
|
||||||
# a custom configuration file can also be specified with `--config` to the build
|
# a custom configuration file can also be specified with `--config` to the build
|
||||||
# system.
|
# system.
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
# Use different pre-set defaults than the global defaults.
|
# Use different pre-set defaults than the global defaults.
|
||||||
#
|
#
|
||||||
# See `src/bootstrap/defaults` for more information.
|
# See `src/bootstrap/defaults` for more information.
|
||||||
# Note that this has no default value (x.py uses the defaults in `config.example.toml`).
|
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
|
||||||
#profile = <none>
|
#profile = <none>
|
||||||
|
|
||||||
# Keeps track of major changes made to this configuration.
|
# Keeps track of major changes made to this configuration.
|
||||||
|
@ -346,7 +346,7 @@
|
||||||
# Enable a build of the extended Rust tool set which is not only the compiler
|
# Enable a build of the extended Rust tool set which is not only the compiler
|
||||||
# but also tools such as Cargo. This will also produce "combined installers"
|
# but also tools such as Cargo. This will also produce "combined installers"
|
||||||
# which are used to install Rust and Cargo together.
|
# which are used to install Rust and Cargo together.
|
||||||
# The `tools` (check `config.example.toml` to see its default value) option specifies
|
# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies
|
||||||
# which tools should be built if `extended = true`.
|
# which tools should be built if `extended = true`.
|
||||||
#
|
#
|
||||||
# This is disabled by default.
|
# This is disabled by default.
|
|
@ -163,7 +163,7 @@ compiler, which will then build the bootstrap binary written in Rust.
|
||||||
|
|
||||||
Because there are two separate codebases behind `x.py`, they need to
|
Because there are two separate codebases behind `x.py`, they need to
|
||||||
be kept in sync. In particular, both `bootstrap.py` and the bootstrap binary
|
be kept in sync. In particular, both `bootstrap.py` and the bootstrap binary
|
||||||
parse `config.toml` and read the same command line arguments. `bootstrap.py`
|
parse `bootstrap.toml` and read the same command line arguments. `bootstrap.py`
|
||||||
keeps these in sync by setting various environment variables, and the
|
keeps these in sync by setting various environment variables, and the
|
||||||
programs sometimes have to add arguments that are explicitly ignored, to be
|
programs sometimes have to add arguments that are explicitly ignored, to be
|
||||||
read by the other.
|
read by the other.
|
||||||
|
|
|
@ -726,7 +726,7 @@ class RustBuild(object):
|
||||||
|
|
||||||
def should_fix_bins_and_dylibs(self):
|
def should_fix_bins_and_dylibs(self):
|
||||||
"""Whether or not `fix_bin_or_dylib` needs to be run; can only be True
|
"""Whether or not `fix_bin_or_dylib` needs to be run; can only be True
|
||||||
on NixOS or if config.toml has `build.patch-binaries-for-nix` set.
|
on NixOS or if bootstrap.toml has `build.patch-binaries-for-nix` set.
|
||||||
"""
|
"""
|
||||||
if self._should_fix_bins_and_dylibs is not None:
|
if self._should_fix_bins_and_dylibs is not None:
|
||||||
return self._should_fix_bins_and_dylibs
|
return self._should_fix_bins_and_dylibs
|
||||||
|
@ -775,7 +775,7 @@ class RustBuild(object):
|
||||||
"The IN_NIX_SHELL environment variable is `{}`;".format(
|
"The IN_NIX_SHELL environment variable is `{}`;".format(
|
||||||
in_nix_shell
|
in_nix_shell
|
||||||
),
|
),
|
||||||
"you may need to set `patch-binaries-for-nix=true` in config.toml",
|
"you may need to set `patch-binaries-for-nix=true` in bootstrap.toml",
|
||||||
)
|
)
|
||||||
|
|
||||||
return is_nixos
|
return is_nixos
|
||||||
|
@ -884,7 +884,7 @@ class RustBuild(object):
|
||||||
return os.path.join(self.build_dir, self.build, subdir)
|
return os.path.join(self.build_dir, self.build, subdir)
|
||||||
|
|
||||||
def get_toml(self, key, section=None):
|
def get_toml(self, key, section=None):
|
||||||
"""Returns the value of the given key in config.toml, otherwise returns None
|
"""Returns the value of the given key in bootstrap.toml, otherwise returns None
|
||||||
|
|
||||||
>>> rb = RustBuild()
|
>>> rb = RustBuild()
|
||||||
>>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"'
|
>>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"'
|
||||||
|
@ -1250,17 +1250,23 @@ def bootstrap(args):
|
||||||
"unless you put them in place manually."
|
"unless you put them in place manually."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`,
|
# Read from `--config` first, followed by `RUST_BOOTSTRAP_CONFIG`.
|
||||||
# then `config.toml` in the root directory.
|
# If neither is set, check `./bootstrap.toml`, then `bootstrap.toml` in the root directory.
|
||||||
|
# If those are unavailable, fall back to `./config.toml`, then `config.toml` for
|
||||||
|
# backward compatibility.
|
||||||
toml_path = args.config or os.getenv("RUST_BOOTSTRAP_CONFIG")
|
toml_path = args.config or os.getenv("RUST_BOOTSTRAP_CONFIG")
|
||||||
using_default_path = toml_path is None
|
using_default_path = toml_path is None
|
||||||
if using_default_path:
|
if using_default_path:
|
||||||
toml_path = "config.toml"
|
toml_path = "bootstrap.toml"
|
||||||
if not os.path.exists(toml_path):
|
if not os.path.exists(toml_path):
|
||||||
toml_path = os.path.join(rust_root, toml_path)
|
toml_path = os.path.join(rust_root, "bootstrap.toml")
|
||||||
|
if not os.path.exists(toml_path):
|
||||||
|
toml_path = "config.toml"
|
||||||
|
if not os.path.exists(toml_path):
|
||||||
|
toml_path = os.path.join(rust_root, "config.toml")
|
||||||
|
|
||||||
# Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
|
# Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
|
||||||
# but not if `config.toml` hasn't been created.
|
# but not if `bootstrap.toml` hasn't been created.
|
||||||
if not using_default_path or os.path.exists(toml_path):
|
if not using_default_path or os.path.exists(toml_path):
|
||||||
with open(toml_path) as config:
|
with open(toml_path) as config:
|
||||||
config_toml = config.read()
|
config_toml = config.read()
|
||||||
|
@ -1278,7 +1284,9 @@ def bootstrap(args):
|
||||||
# profiles to be renamed while maintaining back compatibility
|
# profiles to be renamed while maintaining back compatibility
|
||||||
# Keep in sync with `profile_aliases` in config.rs
|
# Keep in sync with `profile_aliases` in config.rs
|
||||||
profile_aliases = {"user": "dist"}
|
profile_aliases = {"user": "dist"}
|
||||||
include_file = "config.{}.toml".format(profile_aliases.get(profile) or profile)
|
include_file = "bootstrap.{}.toml".format(
|
||||||
|
profile_aliases.get(profile) or profile
|
||||||
|
)
|
||||||
include_dir = os.path.join(rust_root, "src", "bootstrap", "defaults")
|
include_dir = os.path.join(rust_root, "src", "bootstrap", "defaults")
|
||||||
include_path = os.path.join(include_dir, include_file)
|
include_path = os.path.join(include_dir, include_file)
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ class ParseArgsInConfigure(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
class GenerateAndParseConfig(unittest.TestCase):
|
class GenerateAndParseConfig(unittest.TestCase):
|
||||||
"""Test that we can serialize and deserialize a config.toml file"""
|
"""Test that we can serialize and deserialize a bootstrap.toml file"""
|
||||||
|
|
||||||
def test_no_args(self):
|
def test_no_args(self):
|
||||||
build = serialize_and_parse([])
|
build = serialize_and_parse([])
|
||||||
|
@ -206,11 +206,11 @@ class BuildBootstrap(unittest.TestCase):
|
||||||
# problem in most cases, but there is a scenario where it would cause
|
# problem in most cases, but there is a scenario where it would cause
|
||||||
# the test to fail.
|
# the test to fail.
|
||||||
#
|
#
|
||||||
# When a custom local Cargo is configured in config.toml (with the
|
# When a custom local Cargo is configured in bootstrap.toml (with the
|
||||||
# build.cargo setting), no Cargo is downloaded to any location known by
|
# build.cargo setting), no Cargo is downloaded to any location known by
|
||||||
# bootstrap, and bootstrap relies on that setting to find it.
|
# bootstrap, and bootstrap relies on that setting to find it.
|
||||||
#
|
#
|
||||||
# In this test though we are not using the config.toml of the caller:
|
# In this test though we are not using the bootstrap.toml of the caller:
|
||||||
# we are generating a blank one instead. If we don't set build.cargo in
|
# we are generating a blank one instead. If we don't set build.cargo in
|
||||||
# it, the test will have no way to find Cargo, failing the test.
|
# it, the test will have no way to find Cargo, failing the test.
|
||||||
cargo_bin = os.environ.get("BOOTSTRAP_TEST_CARGO_BIN")
|
cargo_bin = os.environ.get("BOOTSTRAP_TEST_CARGO_BIN")
|
||||||
|
|
|
@ -367,8 +367,8 @@ if "--help" in sys.argv or "-h" in sys.argv:
|
||||||
print("\t\t" + option.desc)
|
print("\t\t" + option.desc)
|
||||||
print("")
|
print("")
|
||||||
print("This configure script is a thin configuration shim over the true")
|
print("This configure script is a thin configuration shim over the true")
|
||||||
print("configuration system, `config.toml`. You can explore the comments")
|
print("configuration system, `bootstrap.toml`. You can explore the comments")
|
||||||
print("in `config.example.toml` next to this configure script to see")
|
print("in `bootstrap.example.toml` next to this configure script to see")
|
||||||
print("more information about what each option is. Additionally you can")
|
print("more information about what each option is. Additionally you can")
|
||||||
print("pass `--set` as an argument to set arbitrary key/value pairs")
|
print("pass `--set` as an argument to set arbitrary key/value pairs")
|
||||||
print("in the TOML configuration if desired")
|
print("in the TOML configuration if desired")
|
||||||
|
@ -567,8 +567,8 @@ def apply_args(known_args, option_checking, config):
|
||||||
raise RuntimeError("unhandled option {}".format(option.name))
|
raise RuntimeError("unhandled option {}".format(option.name))
|
||||||
|
|
||||||
|
|
||||||
# "Parse" the `config.example.toml` file into the various sections, and we'll
|
# "Parse" the `bootstrap.example.toml` file into the various sections, and we'll
|
||||||
# use this as a template of a `config.toml` to write out which preserves
|
# use this as a template of a `bootstrap.toml` to write out which preserves
|
||||||
# all the various comments and whatnot.
|
# all the various comments and whatnot.
|
||||||
#
|
#
|
||||||
# Note that the `target` section is handled separately as we'll duplicate it
|
# Note that the `target` section is handled separately as we'll duplicate it
|
||||||
|
@ -581,7 +581,7 @@ def parse_example_config(known_args, config):
|
||||||
targets = {}
|
targets = {}
|
||||||
top_level_keys = []
|
top_level_keys = []
|
||||||
|
|
||||||
with open(rust_dir + "/config.example.toml") as example_config:
|
with open(rust_dir + "/bootstrap.example.toml") as example_config:
|
||||||
example_lines = example_config.read().split("\n")
|
example_lines = example_config.read().split("\n")
|
||||||
for line in example_lines:
|
for line in example_lines:
|
||||||
if cur_section is None:
|
if cur_section is None:
|
||||||
|
@ -755,8 +755,8 @@ def quit_if_file_exists(file):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# If 'config.toml' already exists, exit the script at this point
|
# If 'bootstrap.toml' already exists, exit the script at this point
|
||||||
quit_if_file_exists("config.toml")
|
quit_if_file_exists("bootstrap.toml")
|
||||||
|
|
||||||
if "GITHUB_ACTIONS" in os.environ:
|
if "GITHUB_ACTIONS" in os.environ:
|
||||||
print("::group::Configure the build")
|
print("::group::Configure the build")
|
||||||
|
@ -766,11 +766,11 @@ if __name__ == "__main__":
|
||||||
p("")
|
p("")
|
||||||
section_order, sections, targets = parse_args(sys.argv[1:])
|
section_order, sections, targets = parse_args(sys.argv[1:])
|
||||||
|
|
||||||
# Now that we've built up our `config.toml`, write it all out in the same
|
# Now that we've built up our `bootstrap.toml`, write it all out in the same
|
||||||
# order that we read it in.
|
# order that we read it in.
|
||||||
p("")
|
p("")
|
||||||
p("writing `config.toml` in current directory")
|
p("writing `bootstrap.toml` in current directory")
|
||||||
with bootstrap.output("config.toml") as f:
|
with bootstrap.output("bootstrap.toml") as f:
|
||||||
write_config_toml(f, section_order, targets, sections)
|
write_config_toml(f, section_order, targets, sections)
|
||||||
|
|
||||||
with bootstrap.output("Makefile") as f:
|
with bootstrap.output("Makefile") as f:
|
||||||
|
|
|
@ -77,14 +77,14 @@ fn main() {
|
||||||
check_version(&config)
|
check_version(&config)
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
|
// NOTE: Since `./configure` generates a `bootstrap.toml`, distro maintainers will see the
|
||||||
// changelog warning, not the `x.py setup` message.
|
// changelog warning, not the `x.py setup` message.
|
||||||
let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. });
|
let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. });
|
||||||
if suggest_setup {
|
if suggest_setup {
|
||||||
println!("WARNING: you have not made a `config.toml`");
|
println!("WARNING: you have not made a `bootstrap.toml`");
|
||||||
println!(
|
println!(
|
||||||
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
|
"HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \
|
||||||
`cp config.example.toml config.toml`"
|
`cp bootstrap.example.toml bootstrap.toml`"
|
||||||
);
|
);
|
||||||
} else if let Some(suggestion) = &changelog_suggestion {
|
} else if let Some(suggestion) = &changelog_suggestion {
|
||||||
println!("{suggestion}");
|
println!("{suggestion}");
|
||||||
|
@ -98,10 +98,10 @@ fn main() {
|
||||||
Build::new(config).build();
|
Build::new(config).build();
|
||||||
|
|
||||||
if suggest_setup {
|
if suggest_setup {
|
||||||
println!("WARNING: you have not made a `config.toml`");
|
println!("WARNING: you have not made a `bootstrap.toml`");
|
||||||
println!(
|
println!(
|
||||||
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
|
"HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \
|
||||||
`cp config.example.toml config.toml`"
|
`cp bootstrap.example.toml bootstrap.toml`"
|
||||||
);
|
);
|
||||||
} else if let Some(suggestion) = &changelog_suggestion {
|
} else if let Some(suggestion) = &changelog_suggestion {
|
||||||
println!("{suggestion}");
|
println!("{suggestion}");
|
||||||
|
@ -160,7 +160,7 @@ fn check_version(config: &Config) -> Option<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always try to use `change-id` from .last-warned-change-id first. If it doesn't exist,
|
// Always try to use `change-id` from .last-warned-change-id first. If it doesn't exist,
|
||||||
// then use the one from the config.toml. This way we never show the same warnings
|
// then use the one from the bootstrap.toml. This way we never show the same warnings
|
||||||
// more than once.
|
// more than once.
|
||||||
if let Ok(t) = fs::read_to_string(&warned_id_path) {
|
if let Ok(t) = fs::read_to_string(&warned_id_path) {
|
||||||
let last_warned_id = usize::from_str(&t)
|
let last_warned_id = usize::from_str(&t)
|
||||||
|
@ -185,16 +185,18 @@ fn check_version(config: &Config) -> Option<String> {
|
||||||
|
|
||||||
msg.push_str("NOTE: to silence this warning, ");
|
msg.push_str("NOTE: to silence this warning, ");
|
||||||
msg.push_str(&format!(
|
msg.push_str(&format!(
|
||||||
"update `config.toml` to use `change-id = {latest_change_id}` instead"
|
"update `bootstrap.toml` to use `change-id = {latest_change_id}` instead"
|
||||||
));
|
));
|
||||||
|
|
||||||
if io::stdout().is_terminal() {
|
if io::stdout().is_terminal() {
|
||||||
t!(fs::write(warned_id_path, latest_change_id.to_string()));
|
t!(fs::write(warned_id_path, latest_change_id.to_string()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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");
|
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");
|
||||||
msg.push_str("NOTE: to silence this warning, ");
|
msg.push_str("NOTE: to silence this warning, ");
|
||||||
msg.push_str(&format!("add `change-id = {latest_change_id}` at the top of `config.toml`"));
|
msg.push_str(&format!(
|
||||||
|
"add `change-id = {latest_change_id}` at the top of `bootstrap.toml`"
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(msg)
|
Some(msg)
|
||||||
|
|
|
@ -425,7 +425,7 @@ fn copy_self_contained_objects(
|
||||||
} else if target.contains("-wasi") {
|
} else if target.contains("-wasi") {
|
||||||
let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
|
let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
|
||||||
panic!(
|
panic!(
|
||||||
"Target {:?} does not have a \"wasi-root\" key in Config.toml \
|
"Target {:?} does not have a \"wasi-root\" key in bootstrap.toml \
|
||||||
or `$WASI_SDK_PATH` set",
|
or `$WASI_SDK_PATH` set",
|
||||||
target.triple
|
target.triple
|
||||||
)
|
)
|
||||||
|
@ -1294,7 +1294,7 @@ pub fn rustc_cargo_env(
|
||||||
.env("CFG_VERSION", builder.rust_version());
|
.env("CFG_VERSION", builder.rust_version());
|
||||||
|
|
||||||
// Some tools like Cargo detect their own git information in build scripts. When omit-git-hash
|
// Some tools like Cargo detect their own git information in build scripts. When omit-git-hash
|
||||||
// is enabled in config.toml, we pass this environment variable to tell build scripts to avoid
|
// is enabled in bootstrap.toml, we pass this environment variable to tell build scripts to avoid
|
||||||
// detecting git information on their own.
|
// detecting git information on their own.
|
||||||
if builder.config.omit_git_hash {
|
if builder.config.omit_git_hash {
|
||||||
cargo.env("CFG_OMIT_GIT_HASH", "1");
|
cargo.env("CFG_OMIT_GIT_HASH", "1");
|
||||||
|
@ -1538,7 +1538,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
|
||||||
{
|
{
|
||||||
run.builder.info(
|
run.builder.info(
|
||||||
"WARNING: no codegen-backends config matched the requested path to build a codegen backend. \
|
"WARNING: no codegen-backends config matched the requested path to build a codegen backend. \
|
||||||
HELP: add backend to codegen-backends in config.toml.",
|
HELP: add backend to codegen-backends in bootstrap.toml.",
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1550,7 +1550,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
|
||||||
impl Step for CodegenBackend {
|
impl Step for CodegenBackend {
|
||||||
type Output = ();
|
type Output = ();
|
||||||
const ONLY_HOSTS: bool = true;
|
const ONLY_HOSTS: bool = true;
|
||||||
/// Only the backends specified in the `codegen-backends` entry of `config.toml` are built.
|
/// Only the backends specified in the `codegen-backends` entry of `bootstrap.toml` are built.
|
||||||
const DEFAULT: bool = true;
|
const DEFAULT: bool = true;
|
||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
|
|
|
@ -1000,9 +1000,9 @@ impl Step for PlainSourceTarball {
|
||||||
let src_files = [
|
let src_files = [
|
||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
".gitmodules",
|
".gitmodules",
|
||||||
|
"bootstrap.example.toml",
|
||||||
"Cargo.lock",
|
"Cargo.lock",
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
"config.example.toml",
|
|
||||||
"configure",
|
"configure",
|
||||||
"CONTRIBUTING.md",
|
"CONTRIBUTING.md",
|
||||||
"COPYRIGHT",
|
"COPYRIGHT",
|
||||||
|
|
|
@ -1218,7 +1218,7 @@ impl Step for RustcBook {
|
||||||
cmd.env("RUSTC_BOOTSTRAP", "1");
|
cmd.env("RUSTC_BOOTSTRAP", "1");
|
||||||
|
|
||||||
// If the lib directories are in an unusual location (changed in
|
// If the lib directories are in an unusual location (changed in
|
||||||
// config.toml), then this needs to explicitly update the dylib search
|
// bootstrap.toml), then this needs to explicitly update the dylib search
|
||||||
// path.
|
// path.
|
||||||
builder.add_rustc_lib_path(self.compiler, &mut cmd);
|
builder.add_rustc_lib_path(self.compiler, &mut cmd);
|
||||||
let doc_generator_guard = builder.msg(
|
let doc_generator_guard = builder.msg(
|
||||||
|
|
|
@ -85,11 +85,11 @@ fn install_sh(
|
||||||
} else {
|
} else {
|
||||||
assert!(
|
assert!(
|
||||||
is_dir_writable_for_user(&prefix),
|
is_dir_writable_for_user(&prefix),
|
||||||
"User doesn't have write access on `install.prefix` path in the `config.toml`.",
|
"User doesn't have write access on `install.prefix` path in the `bootstrap.toml`.",
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
is_dir_writable_for_user(&sysconfdir),
|
is_dir_writable_for_user(&sysconfdir),
|
||||||
"User doesn't have write access on `install.sysconfdir` path in `config.toml`."
|
"User doesn't have write access on `install.sysconfdir` path in `bootstrap.toml`."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,7 @@ impl Step for Llvm {
|
||||||
(true, true) => "RelWithDebInfo",
|
(true, true) => "RelWithDebInfo",
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE: remember to also update `config.example.toml` when changing the
|
// NOTE: remember to also update `bootstrap.example.toml` when changing the
|
||||||
// defaults!
|
// defaults!
|
||||||
let llvm_targets = match &builder.config.llvm_targets {
|
let llvm_targets = match &builder.config.llvm_targets {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
|
|
|
@ -147,7 +147,7 @@ pub fn perf(builder: &Builder<'_>, args: &PerfArgs) {
|
||||||
};
|
};
|
||||||
if is_profiling && builder.build.config.rust_debuginfo_level_rustc == DebuginfoLevel::None {
|
if is_profiling && builder.build.config.rust_debuginfo_level_rustc == DebuginfoLevel::None {
|
||||||
builder.info(r#"WARNING: You are compiling rustc without debuginfo, this will make profiling less useful.
|
builder.info(r#"WARNING: You are compiling rustc without debuginfo, this will make profiling less useful.
|
||||||
Consider setting `rust.debuginfo-level = 1` in `config.toml`."#);
|
Consider setting `rust.debuginfo-level = 1` in `bootstrap.toml`."#);
|
||||||
}
|
}
|
||||||
|
|
||||||
let compiler = builder.compiler(builder.top_stage, builder.config.build);
|
let compiler = builder.compiler(builder.top_stage, builder.config.build);
|
||||||
|
|
|
@ -35,10 +35,10 @@ impl Step for BuildManifest {
|
||||||
// (https://github.com/rust-lang/promote-release).
|
// (https://github.com/rust-lang/promote-release).
|
||||||
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
|
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
|
||||||
let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
|
let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
|
||||||
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
|
panic!("\n\nfailed to specify `dist.sign-folder` in `bootstrap.toml`\n\n")
|
||||||
});
|
});
|
||||||
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
|
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
|
||||||
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
|
panic!("\n\nfailed to specify `dist.upload-addr` in `bootstrap.toml`\n\n")
|
||||||
});
|
});
|
||||||
|
|
||||||
let today = command("date").arg("+%Y-%m-%d").run_capture_stdout(builder).stdout();
|
let today = command("date").arg("+%Y-%m-%d").run_capture_stdout(builder).stdout();
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//!
|
//!
|
||||||
//! These are build-and-run steps for `./x.py setup`, which allows quickly setting up the directory
|
//! These are build-and-run steps for `./x.py setup`, which allows quickly setting up the directory
|
||||||
//! for modifying, building, and running the compiler and library. Running arbitrary configuration
|
//! for modifying, building, and running the compiler and library. Running arbitrary configuration
|
||||||
//! allows setting up things that cannot be simply captured inside the config.toml, in addition to
|
//! allows setting up things that cannot be simply captured inside the bootstrap.toml, in addition to
|
||||||
//! leading people away from manually editing most of the config.toml values.
|
//! leading people away from manually editing most of the bootstrap.toml values.
|
||||||
|
|
||||||
use std::env::consts::EXE_SUFFIX;
|
use std::env::consts::EXE_SUFFIX;
|
||||||
use std::fmt::Write as _;
|
use std::fmt::Write as _;
|
||||||
|
@ -37,7 +37,7 @@ static PROFILE_DIR: &str = "src/bootstrap/defaults";
|
||||||
|
|
||||||
impl Profile {
|
impl Profile {
|
||||||
fn include_path(&self, src_path: &Path) -> PathBuf {
|
fn include_path(&self, src_path: &Path) -> PathBuf {
|
||||||
PathBuf::from(format!("{}/{PROFILE_DIR}/config.{}.toml", src_path.display(), self))
|
PathBuf::from(format!("{}/{PROFILE_DIR}/bootstrap.{}.toml", src_path.display(), self))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn all() -> impl Iterator<Item = Self> {
|
pub fn all() -> impl Iterator<Item = Self> {
|
||||||
|
@ -53,7 +53,7 @@ impl Profile {
|
||||||
Compiler => "Contribute to the compiler itself",
|
Compiler => "Contribute to the compiler itself",
|
||||||
Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)",
|
Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)",
|
||||||
Dist => "Install Rust from source",
|
Dist => "Install Rust from source",
|
||||||
None => "Do not modify `config.toml`"
|
None => "Do not modify `bootstrap.toml`"
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ impl Step for Profile {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = &run.builder.config.config.clone().unwrap_or(PathBuf::from("config.toml"));
|
let path = &run.builder.config.config.clone().unwrap_or(PathBuf::from("bootstrap.toml"));
|
||||||
if path.exists() {
|
if path.exists() {
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
@ -203,7 +203,7 @@ pub fn setup(config: &Config, profile: Profile) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = &config.config.clone().unwrap_or(PathBuf::from("config.toml"));
|
let path = &config.config.clone().unwrap_or(PathBuf::from("bootstrap.toml"));
|
||||||
setup_config_toml(path, profile, config);
|
setup_config_toml(path, profile, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1119,7 +1119,7 @@ impl Step for Tidy {
|
||||||
"\
|
"\
|
||||||
ERROR: no `rustfmt` binary found in {PATH}
|
ERROR: no `rustfmt` binary found in {PATH}
|
||||||
INFO: `rust.channel` is currently set to \"{CHAN}\"
|
INFO: `rust.channel` is currently set to \"{CHAN}\"
|
||||||
HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `config.toml` file
|
HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `bootstrap.toml` file
|
||||||
HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`",
|
HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`",
|
||||||
PATH = inferred_rustfmt_dir.display(),
|
PATH = inferred_rustfmt_dir.display(),
|
||||||
CHAN = builder.config.channel,
|
CHAN = builder.config.channel,
|
||||||
|
|
|
@ -128,7 +128,7 @@ impl Step for ToolStateCheck {
|
||||||
/// Checks tool state status.
|
/// Checks tool state status.
|
||||||
///
|
///
|
||||||
/// This is intended to be used in the `checktools.sh` script. To use
|
/// This is intended to be used in the `checktools.sh` script. To use
|
||||||
/// this, set `save-toolstates` in `config.toml` so that tool status will
|
/// this, set `save-toolstates` in `bootstrap.toml` so that tool status will
|
||||||
/// be saved to a JSON file. Then, run `x.py test --no-fail-fast` for all
|
/// be saved to a JSON file. Then, run `x.py test --no-fail-fast` for all
|
||||||
/// of the tools to populate the JSON file. After that is done, this
|
/// of the tools to populate the JSON file. After that is done, this
|
||||||
/// command can be run to check for any status failures, and exits with an
|
/// command can be run to check for any status failures, and exits with an
|
||||||
|
@ -254,7 +254,7 @@ impl Builder<'_> {
|
||||||
/// Updates the actual toolstate of a tool.
|
/// Updates the actual toolstate of a tool.
|
||||||
///
|
///
|
||||||
/// The toolstates are saved to the file specified by the key
|
/// The toolstates are saved to the file specified by the key
|
||||||
/// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be
|
/// `rust.save-toolstates` in `bootstrap.toml`. If unspecified, nothing will be
|
||||||
/// done. The file is updated immediately after this function completes.
|
/// done. The file is updated immediately after this function completes.
|
||||||
pub fn save_toolstate(&self, tool: &str, state: ToolState) {
|
pub fn save_toolstate(&self, tool: &str, state: ToolState) {
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
|
@ -215,7 +215,7 @@ impl Cargo {
|
||||||
// dynamic libraries. We use this by default on Unix platforms to ensure
|
// dynamic libraries. We use this by default on Unix platforms to ensure
|
||||||
// that our nightlies behave the same on Windows, that is they work out
|
// that our nightlies behave the same on Windows, that is they work out
|
||||||
// of the box. This can be disabled by setting `rpath = false` in `[rust]`
|
// of the box. This can be disabled by setting `rpath = false` in `[rust]`
|
||||||
// table of `config.toml`
|
// table of `bootstrap.toml`
|
||||||
//
|
//
|
||||||
// Ok, so the astute might be wondering "why isn't `-C rpath` used
|
// Ok, so the astute might be wondering "why isn't `-C rpath` used
|
||||||
// here?" and that is indeed a good question to ask. This codegen
|
// here?" and that is indeed a good question to ask. This codegen
|
||||||
|
|
|
@ -31,9 +31,9 @@ mod cargo;
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
/// Builds and performs different [`Self::kind`]s of stuff and actions, taking
|
/// Builds and performs different [`Self::kind`]s of stuff and actions, taking
|
||||||
/// into account build configuration from e.g. config.toml.
|
/// into account build configuration from e.g. bootstrap.toml.
|
||||||
pub struct Builder<'a> {
|
pub struct Builder<'a> {
|
||||||
/// Build configuration from e.g. config.toml.
|
/// Build configuration from e.g. bootstrap.toml.
|
||||||
pub build: &'a Build,
|
pub build: &'a Build,
|
||||||
|
|
||||||
/// The stage to use. Either implicitly determined based on subcommand, or
|
/// The stage to use. Either implicitly determined based on subcommand, or
|
||||||
|
@ -332,7 +332,7 @@ impl PathSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PATH_REMAP: &[(&str, &[&str])] = &[
|
const PATH_REMAP: &[(&str, &[&str])] = &[
|
||||||
// config.toml uses `rust-analyzer-proc-macro-srv`, but the
|
// bootstrap.toml uses `rust-analyzer-proc-macro-srv`, but the
|
||||||
// actual path is `proc-macro-srv-cli`
|
// actual path is `proc-macro-srv-cli`
|
||||||
("rust-analyzer-proc-macro-srv", &["src/tools/rust-analyzer/crates/proc-macro-srv-cli"]),
|
("rust-analyzer-proc-macro-srv", &["src/tools/rust-analyzer/crates/proc-macro-srv-cli"]),
|
||||||
// Make `x test tests` function the same as `x t tests/*`
|
// Make `x test tests` function the same as `x t tests/*`
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Serialized configuration of a build.
|
//! Serialized configuration of a build.
|
||||||
//!
|
//!
|
||||||
//! This module implements parsing `config.toml` configuration files to tweak
|
//! This module implements parsing `bootstrap.toml` configuration files to tweak
|
||||||
//! how the build runs.
|
//! how the build runs.
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
|
@ -64,7 +64,7 @@ macro_rules! check_ci_llvm {
|
||||||
/// useful in scenarios where developers want to see how the tarball sources were
|
/// useful in scenarios where developers want to see how the tarball sources were
|
||||||
/// generated.
|
/// generated.
|
||||||
///
|
///
|
||||||
/// We also use this file to compare the host's config.toml against the CI rustc builder
|
/// We also use this file to compare the host's bootstrap.toml against the CI rustc builder
|
||||||
/// configuration to detect any incompatible options.
|
/// configuration to detect any incompatible options.
|
||||||
pub(crate) const BUILDER_CONFIG_FILENAME: &str = "builder-config";
|
pub(crate) const BUILDER_CONFIG_FILENAME: &str = "builder-config";
|
||||||
|
|
||||||
|
@ -184,12 +184,12 @@ pub enum GccCiMode {
|
||||||
|
|
||||||
/// Global configuration for the entire build and/or bootstrap.
|
/// Global configuration for the entire build and/or bootstrap.
|
||||||
///
|
///
|
||||||
/// This structure is parsed from `config.toml`, and some of the fields are inferred from `git` or build-time parameters.
|
/// This structure is parsed from `bootstrap.toml`, and some of the fields are inferred from `git` or build-time parameters.
|
||||||
///
|
///
|
||||||
/// Note that this structure is not decoded directly into, but rather it is
|
/// Note that this structure is not decoded directly into, but rather it is
|
||||||
/// filled out from the decoded forms of the structs below. For documentation
|
/// filled out from the decoded forms of the structs below. For documentation
|
||||||
/// each field, see the corresponding fields in
|
/// each field, see the corresponding fields in
|
||||||
/// `config.example.toml`.
|
/// `bootstrap.example.toml`.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub change_id: Option<usize>,
|
pub change_id: Option<usize>,
|
||||||
|
@ -235,7 +235,7 @@ pub struct Config {
|
||||||
pub keep_stage: Vec<u32>,
|
pub keep_stage: Vec<u32>,
|
||||||
pub keep_stage_std: Vec<u32>,
|
pub keep_stage_std: Vec<u32>,
|
||||||
pub src: PathBuf,
|
pub src: PathBuf,
|
||||||
/// defaults to `config.toml`
|
/// defaults to `bootstrap.toml`
|
||||||
pub config: Option<PathBuf>,
|
pub config: Option<PathBuf>,
|
||||||
pub jobs: Option<u32>,
|
pub jobs: Option<u32>,
|
||||||
pub cmd: Subcommand,
|
pub cmd: Subcommand,
|
||||||
|
@ -470,7 +470,7 @@ impl std::str::FromStr for SplitDebuginfo {
|
||||||
|
|
||||||
impl SplitDebuginfo {
|
impl SplitDebuginfo {
|
||||||
/// Returns the default `-Csplit-debuginfo` value for the current target. See the comment for
|
/// Returns the default `-Csplit-debuginfo` value for the current target. See the comment for
|
||||||
/// `rust.split-debuginfo` in `config.example.toml`.
|
/// `rust.split-debuginfo` in `bootstrap.example.toml`.
|
||||||
fn default_for_platform(target: TargetSelection) -> Self {
|
fn default_for_platform(target: TargetSelection) -> Self {
|
||||||
if target.contains("apple") {
|
if target.contains("apple") {
|
||||||
SplitDebuginfo::Unpacked
|
SplitDebuginfo::Unpacked
|
||||||
|
@ -677,7 +677,7 @@ impl Target {
|
||||||
target
|
target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Structure of the `config.toml` file that configuration is read from.
|
/// Structure of the `bootstrap.toml` file that configuration is read from.
|
||||||
///
|
///
|
||||||
/// This structure uses `Decodable` to automatically decode a TOML configuration
|
/// This structure uses `Decodable` to automatically decode a TOML configuration
|
||||||
/// file into this format, and then this is traversed and written into the above
|
/// file into this format, and then this is traversed and written into the above
|
||||||
|
@ -1485,26 +1485,35 @@ impl Config {
|
||||||
|
|
||||||
config.stage0_metadata = build_helper::stage0_parser::parse_stage0_file();
|
config.stage0_metadata = build_helper::stage0_parser::parse_stage0_file();
|
||||||
|
|
||||||
// Find configuration file, with the following cascading fallback (first match wins):
|
// Locate the configuration file using the following priority (first match wins):
|
||||||
// - `--config <path>`
|
// 1. `--config <path>` (explicit flag)
|
||||||
// - `RUST_BOOTSTRAP_CONFIG`
|
// 2. `RUST_BOOTSTRAP_CONFIG` environment variable
|
||||||
// - `./config.toml`
|
// 3. `./bootstrap.toml` (local file)
|
||||||
// - `config.toml` in the root directory.
|
// 4. `<root>/bootstrap.toml`
|
||||||
|
// 5. `./config.toml` (fallback for backward compatibility)
|
||||||
|
// 6. `<root>/config.toml`
|
||||||
let toml_path = flags
|
let toml_path = flags
|
||||||
.config
|
.config
|
||||||
.clone()
|
.clone()
|
||||||
.or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from));
|
.or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from));
|
||||||
let using_default_path = toml_path.is_none();
|
let using_default_path = toml_path.is_none();
|
||||||
let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("config.toml"));
|
let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("bootstrap.toml"));
|
||||||
|
|
||||||
if using_default_path && !toml_path.exists() {
|
if using_default_path && !toml_path.exists() {
|
||||||
toml_path = config.src.join(toml_path);
|
toml_path = config.src.join(PathBuf::from("bootstrap.toml"));
|
||||||
|
if !toml_path.exists() {
|
||||||
|
toml_path = PathBuf::from("config.toml");
|
||||||
|
if !toml_path.exists() {
|
||||||
|
toml_path = config.src.join(PathBuf::from("config.toml"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
|
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
|
||||||
let ci_channel = file_content.trim_end();
|
let ci_channel = file_content.trim_end();
|
||||||
|
|
||||||
// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
|
// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
|
||||||
// but not if `config.toml` hasn't been created.
|
// but not if `bootstrap.toml` hasn't been created.
|
||||||
let mut toml = if !using_default_path || toml_path.exists() {
|
let mut toml = if !using_default_path || toml_path.exists() {
|
||||||
config.config = Some(if cfg!(not(test)) {
|
config.config = Some(if cfg!(not(test)) {
|
||||||
toml_path.canonicalize().unwrap()
|
toml_path.canonicalize().unwrap()
|
||||||
|
@ -1525,7 +1534,7 @@ impl Config {
|
||||||
// same ones used to call the tests (if custom ones are not defined in the toml). If we
|
// same ones used to call the tests (if custom ones are not defined in the toml). If we
|
||||||
// don't do that, bootstrap will use its own detection logic to find a suitable rustc
|
// don't do that, bootstrap will use its own detection logic to find a suitable rustc
|
||||||
// and Cargo, which doesn't work when the caller is specìfying a custom local rustc or
|
// and Cargo, which doesn't work when the caller is specìfying a custom local rustc or
|
||||||
// Cargo in their config.toml.
|
// Cargo in their bootstrap.toml.
|
||||||
let build = toml.build.get_or_insert_with(Default::default);
|
let build = toml.build.get_or_insert_with(Default::default);
|
||||||
build.rustc = build.rustc.take().or(std::env::var_os("RUSTC").map(|p| p.into()));
|
build.rustc = build.rustc.take().or(std::env::var_os("RUSTC").map(|p| p.into()));
|
||||||
build.cargo = build.cargo.take().or(std::env::var_os("CARGO").map(|p| p.into()));
|
build.cargo = build.cargo.take().or(std::env::var_os("CARGO").map(|p| p.into()));
|
||||||
|
@ -1548,7 +1557,7 @@ impl Config {
|
||||||
include_path.push("src");
|
include_path.push("src");
|
||||||
include_path.push("bootstrap");
|
include_path.push("bootstrap");
|
||||||
include_path.push("defaults");
|
include_path.push("defaults");
|
||||||
include_path.push(format!("config.{include}.toml"));
|
include_path.push(format!("bootstrap.{include}.toml"));
|
||||||
let included_toml = get_toml(&include_path).unwrap_or_else(|e| {
|
let included_toml = get_toml(&include_path).unwrap_or_else(|e| {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"ERROR: Failed to parse default config profile at '{}': {e}",
|
"ERROR: Failed to parse default config profile at '{}': {e}",
|
||||||
|
@ -2030,7 +2039,7 @@ impl Config {
|
||||||
config.description = description;
|
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 bootstrap.toml,
|
||||||
// tests may fail due to using a different channel than the one used by the compiler during tests.
|
// tests may fail due to using a different channel than the one used by the compiler during tests.
|
||||||
if let Some(commit) = &config.download_rustc_commit {
|
if let Some(commit) = &config.download_rustc_commit {
|
||||||
if is_user_configured_rust_channel {
|
if is_user_configured_rust_channel {
|
||||||
|
@ -2655,7 +2664,7 @@ impl Config {
|
||||||
return None;
|
return None;
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("ERROR: Failed to parse CI rustc config.toml: {e}");
|
eprintln!("ERROR: Failed to parse CI rustc bootstrap.toml: {e}");
|
||||||
exit!(2);
|
exit!(2);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2818,7 +2827,7 @@ impl Config {
|
||||||
///
|
///
|
||||||
/// `relative_path` should be relative to the root of the git repository, not an absolute path.
|
/// `relative_path` should be relative to the root of the git repository, not an absolute path.
|
||||||
///
|
///
|
||||||
/// This *does not* update the submodule if `config.toml` explicitly says
|
/// This *does not* update the submodule if `bootstrap.toml` explicitly says
|
||||||
/// not to, or if we're not in a git repository (like a plain source
|
/// not to, or if we're not in a git repository (like a plain source
|
||||||
/// tarball). Typically [`crate::Build::require_submodule`] should be
|
/// tarball). Typically [`crate::Build::require_submodule`] should be
|
||||||
/// used instead to provide a nice error to the user if the submodule is
|
/// used instead to provide a nice error to the user if the submodule is
|
||||||
|
@ -3042,7 +3051,9 @@ impl Config {
|
||||||
}
|
}
|
||||||
println!("ERROR: could not find commit hash for downloading rustc");
|
println!("ERROR: could not find commit hash for downloading rustc");
|
||||||
println!("HELP: maybe your repository history is too shallow?");
|
println!("HELP: maybe your repository history is too shallow?");
|
||||||
println!("HELP: consider setting `rust.download-rustc=false` in config.toml");
|
println!(
|
||||||
|
"HELP: consider setting `rust.download-rustc=false` in bootstrap.toml"
|
||||||
|
);
|
||||||
println!("HELP: or fetch enough history to include one upstream commit");
|
println!("HELP: or fetch enough history to include one upstream commit");
|
||||||
crate::exit!(1);
|
crate::exit!(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub struct Flags {
|
||||||
/// TOML configuration file for build
|
/// TOML configuration file for build
|
||||||
pub config: Option<PathBuf>,
|
pub config: Option<PathBuf>,
|
||||||
#[arg(global = true, long, value_hint = clap::ValueHint::DirPath, value_name = "DIR")]
|
#[arg(global = true, long, value_hint = clap::ValueHint::DirPath, value_name = "DIR")]
|
||||||
/// Build directory, overrides `build.build-dir` in `config.toml`
|
/// Build directory, overrides `build.build-dir` in `bootstrap.toml`
|
||||||
pub build_dir: Option<PathBuf>,
|
pub build_dir: Option<PathBuf>,
|
||||||
|
|
||||||
#[arg(global = true, long, value_hint = clap::ValueHint::Other, value_name = "BUILD")]
|
#[arg(global = true, long, value_hint = clap::ValueHint::Other, value_name = "BUILD")]
|
||||||
|
@ -173,7 +173,7 @@ pub struct Flags {
|
||||||
#[arg(global = true)]
|
#[arg(global = true)]
|
||||||
/// paths for the subcommand
|
/// paths for the subcommand
|
||||||
pub paths: Vec<PathBuf>,
|
pub paths: Vec<PathBuf>,
|
||||||
/// override options in config.toml
|
/// override options in bootstrap.toml
|
||||||
#[arg(global = true, value_hint = clap::ValueHint::Other, long, value_name = "section.option=value")]
|
#[arg(global = true, value_hint = clap::ValueHint::Other, long, value_name = "section.option=value")]
|
||||||
pub set: Vec<String>,
|
pub set: Vec<String>,
|
||||||
/// arguments passed to subcommands
|
/// arguments passed to subcommands
|
||||||
|
@ -448,7 +448,7 @@ pub enum Subcommand {
|
||||||
/// Set up the environment for development
|
/// Set up the environment for development
|
||||||
#[command(long_about = format!(
|
#[command(long_about = format!(
|
||||||
"\n
|
"\n
|
||||||
x.py setup creates a `config.toml` which changes the defaults for x.py itself,
|
x.py setup creates a `bootstrap.toml` which changes the defaults for x.py itself,
|
||||||
as well as setting up a git pre-push hook, VS Code config and toolchain link.
|
as well as setting up a git pre-push hook, VS Code config and toolchain link.
|
||||||
Arguments:
|
Arguments:
|
||||||
This subcommand accepts a 'profile' to use for builds. For example:
|
This subcommand accepts a 'profile' to use for builds. For example:
|
||||||
|
@ -461,7 +461,7 @@ Arguments:
|
||||||
./x.py setup editor
|
./x.py setup editor
|
||||||
./x.py setup link", Profile::all_for_help(" ").trim_end()))]
|
./x.py setup link", Profile::all_for_help(" ").trim_end()))]
|
||||||
Setup {
|
Setup {
|
||||||
/// Either the profile for `config.toml` or another setup action.
|
/// Either the profile for `bootstrap.toml` or another setup action.
|
||||||
/// May be omitted to set up interactively
|
/// May be omitted to set up interactively
|
||||||
#[arg(value_name = "<PROFILE>|hook|editor|link")]
|
#[arg(value_name = "<PROFILE>|hook|editor|link")]
|
||||||
profile: Option<PathBuf>,
|
profile: Option<PathBuf>,
|
||||||
|
|
|
@ -69,7 +69,7 @@ fn detect_src_and_out() {
|
||||||
let expected_src = manifest_dir.ancestors().nth(2).unwrap();
|
let expected_src = manifest_dir.ancestors().nth(2).unwrap();
|
||||||
assert_eq!(&cfg.src, expected_src);
|
assert_eq!(&cfg.src, expected_src);
|
||||||
|
|
||||||
// test if build-dir was manually given in config.toml
|
// test if build-dir was manually given in bootstrap.toml
|
||||||
if let Some(custom_build_dir) = build_dir {
|
if let Some(custom_build_dir) = build_dir {
|
||||||
assert_eq!(&cfg.out, Path::new(custom_build_dir));
|
assert_eq!(&cfg.out, Path::new(custom_build_dir));
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ fn override_toml_duplicate() {
|
||||||
fn profile_user_dist() {
|
fn profile_user_dist() {
|
||||||
fn get_toml(file: &Path) -> Result<TomlConfig, toml::de::Error> {
|
fn get_toml(file: &Path) -> Result<TomlConfig, toml::de::Error> {
|
||||||
let contents =
|
let contents =
|
||||||
if file.ends_with("config.toml") || env::var_os("RUST_BOOTSTRAP_CONFIG").is_some() {
|
if file.ends_with("bootstrap.toml") || env::var_os("RUST_BOOTSTRAP_CONFIG").is_some() {
|
||||||
"profile = \"user\"".to_owned()
|
"profile = \"user\"".to_owned()
|
||||||
} else {
|
} else {
|
||||||
assert!(file.ends_with("config.dist.toml"));
|
assert!(file.ends_with("config.dist.toml"));
|
||||||
|
@ -402,7 +402,7 @@ fn jobs_precedence() {
|
||||||
);
|
);
|
||||||
assert_eq!(config.jobs, Some(67890));
|
assert_eq!(config.jobs, Some(67890));
|
||||||
|
|
||||||
// `--set build.jobs` should take precedence over `config.toml`.
|
// `--set build.jobs` should take precedence over `bootstrap.toml`.
|
||||||
let config = Config::parse_inner(
|
let config = Config::parse_inner(
|
||||||
Flags::parse(&[
|
Flags::parse(&[
|
||||||
"check".to_owned(),
|
"check".to_owned(),
|
||||||
|
@ -420,7 +420,7 @@ fn jobs_precedence() {
|
||||||
);
|
);
|
||||||
assert_eq!(config.jobs, Some(12345));
|
assert_eq!(config.jobs, Some(12345));
|
||||||
|
|
||||||
// `--jobs` > `--set build.jobs` > `config.toml`
|
// `--jobs` > `--set build.jobs` > `bootstrap.toml`
|
||||||
let config = Config::parse_inner(
|
let config = Config::parse_inner(
|
||||||
Flags::parse(&[
|
Flags::parse(&[
|
||||||
"check".to_owned(),
|
"check".to_owned(),
|
||||||
|
|
|
@ -124,7 +124,7 @@ impl Config {
|
||||||
if let Ok(in_nix_shell) = in_nix_shell {
|
if let Ok(in_nix_shell) = in_nix_shell {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"The IN_NIX_SHELL environment variable is `{in_nix_shell}`; \
|
"The IN_NIX_SHELL environment variable is `{in_nix_shell}`; \
|
||||||
you may need to set `patch-binaries-for-nix=true` in config.toml"
|
you may need to set `patch-binaries-for-nix=true` in bootstrap.toml"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,7 +699,7 @@ impl Config {
|
||||||
help_on_error = "ERROR: failed to download pre-built rustc from CI
|
help_on_error = "ERROR: failed to download pre-built rustc from CI
|
||||||
|
|
||||||
NOTE: old builds get deleted after a certain time
|
NOTE: old builds get deleted after a certain time
|
||||||
HELP: if trying to compile an old commit of rustc, disable `download-rustc` in config.toml:
|
HELP: if trying to compile an old commit of rustc, disable `download-rustc` in bootstrap.toml:
|
||||||
|
|
||||||
[rust]
|
[rust]
|
||||||
download-rustc = false
|
download-rustc = false
|
||||||
|
@ -783,7 +783,7 @@ download-rustc = false
|
||||||
println!("HELP: Consider rebasing to a newer commit if available.");
|
println!("HELP: Consider rebasing to a newer commit if available.");
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("ERROR: Failed to parse CI LLVM config.toml: {e}");
|
eprintln!("ERROR: Failed to parse CI LLVM bootstrap.toml: {e}");
|
||||||
exit!(2);
|
exit!(2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -816,7 +816,7 @@ download-rustc = false
|
||||||
HELP: There could be two reasons behind this:
|
HELP: There could be two reasons behind this:
|
||||||
1) The host triple is not supported for `download-ci-llvm`.
|
1) The host triple is not supported for `download-ci-llvm`.
|
||||||
2) Old builds get deleted after a certain time.
|
2) Old builds get deleted after a certain time.
|
||||||
HELP: In either case, disable `download-ci-llvm` in your config.toml:
|
HELP: In either case, disable `download-ci-llvm` in your bootstrap.toml:
|
||||||
|
|
||||||
[llvm]
|
[llvm]
|
||||||
download-ci-llvm = false
|
download-ci-llvm = false
|
||||||
|
|
|
@ -153,7 +153,7 @@ pub fn check(build: &mut Build) {
|
||||||
Couldn't find required command: cmake
|
Couldn't find required command: cmake
|
||||||
|
|
||||||
You should install cmake, or set `download-ci-llvm = true` in the
|
You should install cmake, or set `download-ci-llvm = true` in the
|
||||||
`[llvm]` section of `config.toml` to download LLVM rather
|
`[llvm]` section of `bootstrap.toml` to download LLVM rather
|
||||||
than building it.
|
than building it.
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
|
@ -339,7 +339,7 @@ than building it.
|
||||||
None => panic!(
|
None => panic!(
|
||||||
"when targeting MUSL either the rust.musl-root \
|
"when targeting MUSL either the rust.musl-root \
|
||||||
option or the target.$TARGET.musl-root option must \
|
option or the target.$TARGET.musl-root option must \
|
||||||
be specified in config.toml"
|
be specified in bootstrap.toml"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ pub enum GitRepo {
|
||||||
/// organize).
|
/// organize).
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Build {
|
pub struct Build {
|
||||||
/// User-specified configuration from `config.toml`.
|
/// User-specified configuration from `bootstrap.toml`.
|
||||||
config: Config,
|
config: Config,
|
||||||
|
|
||||||
// Version information
|
// Version information
|
||||||
|
@ -538,7 +538,7 @@ impl Build {
|
||||||
/// This avoids contributors checking in a submodule change by accident.
|
/// This avoids contributors checking in a submodule change by accident.
|
||||||
fn update_existing_submodules(&self) {
|
fn update_existing_submodules(&self) {
|
||||||
// Avoid running git when there isn't a git checkout, or the user has
|
// Avoid running git when there isn't a git checkout, or the user has
|
||||||
// explicitly disabled submodules in `config.toml`.
|
// explicitly disabled submodules in `bootstrap.toml`.
|
||||||
if !self.config.submodules() {
|
if !self.config.submodules() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -671,7 +671,7 @@ impl Build {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the space-separated set of activated features for the standard library.
|
/// Gets the space-separated set of activated features for the standard library.
|
||||||
/// This can be configured with the `std-features` key in config.toml.
|
/// This can be configured with the `std-features` key in bootstrap.toml.
|
||||||
fn std_features(&self, target: TargetSelection) -> String {
|
fn std_features(&self, target: TargetSelection) -> String {
|
||||||
let mut features: BTreeSet<&str> =
|
let mut features: BTreeSet<&str> =
|
||||||
self.config.rust_std_features.iter().map(|s| s.as_str()).collect();
|
self.config.rust_std_features.iter().map(|s| s.as_str()).collect();
|
||||||
|
@ -1925,7 +1925,7 @@ Couldn't find required command: ninja (or ninja-build)
|
||||||
|
|
||||||
You should install ninja as described at
|
You should install ninja as described at
|
||||||
<https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages>,
|
<https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages>,
|
||||||
or set `ninja = false` in the `[llvm]` section of `config.toml`.
|
or set `ninja = false` in the `[llvm]` section of `bootstrap.toml`.
|
||||||
Alternatively, set `download-ci-llvm = true` in that `[llvm]` section
|
Alternatively, set `download-ci-llvm = true` in that `[llvm]` section
|
||||||
to download LLVM rather than building it.
|
to download LLVM rather than building it.
|
||||||
"
|
"
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
//! C and C++ compilers for each target configured. A compiler is found through
|
//! C and C++ compilers for each target configured. A compiler is found through
|
||||||
//! a number of vectors (in order of precedence)
|
//! a number of vectors (in order of precedence)
|
||||||
//!
|
//!
|
||||||
//! 1. Configuration via `target.$target.cc` in `config.toml`.
|
//! 1. Configuration via `target.$target.cc` in `bootstrap.toml`.
|
||||||
//! 2. Configuration via `target.$target.android-ndk` in `config.toml`, if
|
//! 2. Configuration via `target.$target.android-ndk` in `bootstrap.toml`, if
|
||||||
//! applicable
|
//! applicable
|
||||||
//! 3. Special logic to probe on OpenBSD
|
//! 3. Special logic to probe on OpenBSD
|
||||||
//! 4. The `CC_$target` environment variable.
|
//! 4. The `CC_$target` environment variable.
|
||||||
|
@ -195,7 +195,7 @@ fn default_compiler(
|
||||||
) -> Option<PathBuf> {
|
) -> Option<PathBuf> {
|
||||||
match &*target.triple {
|
match &*target.triple {
|
||||||
// When compiling for android we may have the NDK configured in the
|
// When compiling for android we may have the NDK configured in the
|
||||||
// config.toml in which case we look there. Otherwise the default
|
// bootstrap.toml in which case we look there. Otherwise the default
|
||||||
// compiler already takes into account the triple in question.
|
// compiler already takes into account the triple in question.
|
||||||
t if t.contains("android") => {
|
t if t.contains("android") => {
|
||||||
build.config.android_ndk.as_ref().map(|ndk| ndk_compiler(compiler, &target.triple, ndk))
|
build.config.android_ndk.as_ref().map(|ndk| ndk_compiler(compiler, &target.triple, ndk))
|
||||||
|
|
|
@ -385,4 +385,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
|
||||||
severity: ChangeSeverity::Info,
|
severity: ChangeSeverity::Info,
|
||||||
summary: "New option `build.exclude` that adds support for excluding test.",
|
summary: "New option `build.exclude` that adds support for excluding test.",
|
||||||
},
|
},
|
||||||
|
ChangeInfo {
|
||||||
|
change_id: 137081,
|
||||||
|
severity: ChangeSeverity::Info,
|
||||||
|
summary: "The default configuration filename has changed from `config.toml` to `bootstrap.toml`. `config.toml` is deprecated but remains supported for backward compatibility.",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -421,7 +421,7 @@ trigger_files = [
|
||||||
trigger_files = [
|
trigger_files = [
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
"configure",
|
"configure",
|
||||||
"config.example.toml",
|
"bootstrap.example.toml",
|
||||||
"src/bootstrap",
|
"src/bootstrap",
|
||||||
"src/build_helper",
|
"src/build_helper",
|
||||||
"src/tools/rust-installer",
|
"src/tools/rust-installer",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue