pub artifacts_server: String,
pub artifacts_with_llvm_assertions_server: String,
pub git_merge_commit_email: String,
+ pub nightly_branch: String,
}
#[derive(Default, Deserialize)]
#[cfg_attr(test, derive(Clone))]
impl Target {
pub fn from_triple(triple: &str) -> Self {
let mut target: Self = Default::default();
- if triple.contains("-none") || triple.contains("nvptx") {
+ if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true;
}
target
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_generate = flags.rust_profile_generate.or(rust.profile_generate);
- config.download_rustc_commit = download_ci_rustc_commit(
- &config.stage0_metadata,
- rust.download_rustc,
- config.verbose > 0,
- );
+ config.download_rustc_commit = download_ci_rustc_commit(&config, rust.download_rustc);
} else {
config.rust_profile_use = flags.rust_profile_use;
config.rust_profile_generate = flags.rust_profile_generate;
config
}
+ /// A git invocation which runs inside the source directory.
+ ///
+ /// Use this rather than `Command::new("git")` in order to support out-of-tree builds.
+ pub(crate) fn git(&self) -> Command {
+ let mut git = Command::new("git");
+ git.current_dir(&self.src);
+ git
+ }
+
/// Try to find the relative path of `bindir`, otherwise return it in full.
pub fn bindir_relative(&self) -> &Path {
let bindir = &self.bindir;
/// Returns the commit to download, or `None` if we shouldn't download CI artifacts.
fn download_ci_rustc_commit(
- stage0_metadata: &Stage0Metadata,
+ config: &Config,
download_rustc: Option<StringOrBool>,
- verbose: bool,
) -> Option<String> {
// If `download-rustc` is not set, default to rebuilding.
let if_unchanged = match download_rustc {
};
// Handle running from a directory other than the top level
- let top_level = output(Command::new("git").args(&["rev-parse", "--show-toplevel"]));
+ let top_level = output(config.git().args(&["rev-parse", "--show-toplevel"]));
let top_level = top_level.trim_end();
let compiler = format!("{top_level}/compiler/");
let library = format!("{top_level}/library/");
// Look for a version to compare to based on the current commit.
// Only commits merged by bors will have CI artifacts.
let merge_base = output(
- Command::new("git")
+ config
+ .git()
.arg("rev-list")
- .arg(format!("--author={}", stage0_metadata.config.git_merge_commit_email))
+ .arg(format!("--author={}", config.stage0_metadata.config.git_merge_commit_email))
.args(&["-n1", "--first-parent", "HEAD"]),
);
let commit = merge_base.trim_end();
}
// Warn if there were changes to the compiler or standard library since the ancestor commit.
- let has_changes = !t!(Command::new("git")
+ let has_changes = !t!(config
+ .git()
.args(&["diff-index", "--quiet", &commit, "--", &compiler, &library])
.status())
.success();
if has_changes {
if if_unchanged {
- if verbose {
+ if config.verbose > 0 {
println!(
"warning: saw changes to compiler/ or library/ since {commit}; \
ignoring `download-rustc`"