Rollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum
Add `download-rustc = "if-unchanged"` This allows keeping the setting to a fixed value without having to toggle it when you want to work on the compiler instead of on tools. This sets `BOOTSTRAP_DOWNLOAD_RUSTC` in bootstrap.py so rustbuild doesn't have to try and replicate its logic. Helps with https://github.com/rust-lang/rust/issues/81930. r? `@Mark-Simulacrum` cc `@camelid`
This commit is contained in:
commit
335a3c4b7f
3 changed files with 13 additions and 4 deletions
|
@ -373,7 +373,9 @@ changelog-seen = 2
|
||||||
# Whether to download the stage 1 and 2 compilers from CI.
|
# Whether to download the stage 1 and 2 compilers from CI.
|
||||||
# This is mostly useful for tools; if you have changes to `compiler/` they will be ignored.
|
# This is mostly useful for tools; if you have changes to `compiler/` they will be ignored.
|
||||||
#
|
#
|
||||||
# FIXME: currently, this also uses the downloaded compiler for stage0, but that causes unnecessary rebuilds.
|
# You can set this to "if-unchanged" to only download if `compiler/` has not been modified.
|
||||||
|
#
|
||||||
|
# FIXME(#82739): currently, this also uses the downloaded compiler for stage0, but that causes unnecessary rebuilds.
|
||||||
#download-rustc = false
|
#download-rustc = false
|
||||||
|
|
||||||
# Number of codegen units to use for each compiler invocation. A value of 0
|
# Number of codegen units to use for each compiler invocation. A value of 0
|
||||||
|
|
|
@ -644,8 +644,10 @@ class RustBuild(object):
|
||||||
# If `download-rustc` is set, download the most recent commit with CI artifacts
|
# If `download-rustc` is set, download the most recent commit with CI artifacts
|
||||||
def maybe_download_ci_toolchain(self):
|
def maybe_download_ci_toolchain(self):
|
||||||
# If `download-rustc` is not set, default to rebuilding.
|
# If `download-rustc` is not set, default to rebuilding.
|
||||||
if self.get_toml("download-rustc", section="rust") != "true":
|
download_rustc = self.get_toml("download-rustc", section="rust")
|
||||||
|
if download_rustc is None or download_rustc == "false":
|
||||||
return None
|
return None
|
||||||
|
assert download_rustc == "true" or download_rustc == "if-unchanged", download_rustc
|
||||||
|
|
||||||
# Handle running from a directory other than the top level
|
# Handle running from a directory other than the top level
|
||||||
rev_parse = ["git", "rev-parse", "--show-toplevel"]
|
rev_parse = ["git", "rev-parse", "--show-toplevel"]
|
||||||
|
@ -660,6 +662,8 @@ class RustBuild(object):
|
||||||
# Warn if there were changes to the compiler since the ancestor commit.
|
# Warn if there were changes to the compiler since the ancestor commit.
|
||||||
status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler])
|
status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler])
|
||||||
if status != 0:
|
if status != 0:
|
||||||
|
if download_rustc == "if-unchanged":
|
||||||
|
return None
|
||||||
print("warning: `download-rustc` is enabled, but there are changes to compiler/")
|
print("warning: `download-rustc` is enabled, but there are changes to compiler/")
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
|
@ -1175,6 +1179,8 @@ def bootstrap(help_triggered):
|
||||||
env["RUSTC_BOOTSTRAP"] = '1'
|
env["RUSTC_BOOTSTRAP"] = '1'
|
||||||
if toml_path:
|
if toml_path:
|
||||||
env["BOOTSTRAP_CONFIG"] = toml_path
|
env["BOOTSTRAP_CONFIG"] = toml_path
|
||||||
|
if build.rustc_commit is not None:
|
||||||
|
env["BOOTSTRAP_DOWNLOAD_RUSTC"] = '1'
|
||||||
run(args, env=env, verbose=build.verbose)
|
run(args, env=env, verbose=build.verbose)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -510,7 +510,8 @@ struct Rust {
|
||||||
new_symbol_mangling: Option<bool>,
|
new_symbol_mangling: Option<bool>,
|
||||||
profile_generate: Option<String>,
|
profile_generate: Option<String>,
|
||||||
profile_use: Option<String>,
|
profile_use: Option<String>,
|
||||||
download_rustc: Option<bool>,
|
// ignored; this is set from an env var set by bootstrap.py
|
||||||
|
download_rustc: Option<StringOrBool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TOML representation of how each build target is configured.
|
/// TOML representation of how each build target is configured.
|
||||||
|
@ -852,7 +853,7 @@ impl Config {
|
||||||
config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config);
|
config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config);
|
||||||
config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use);
|
config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use);
|
||||||
config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate);
|
config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate);
|
||||||
config.download_rustc = rust.download_rustc.unwrap_or(false);
|
config.download_rustc = env::var("BOOTSTRAP_DOWNLOAD_RUSTC").as_deref() == Ok("1");
|
||||||
} else {
|
} else {
|
||||||
config.rust_profile_use = flags.rust_profile_use;
|
config.rust_profile_use = flags.rust_profile_use;
|
||||||
config.rust_profile_generate = flags.rust_profile_generate;
|
config.rust_profile_generate = flags.rust_profile_generate;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue