提交 e7342b8f 编写于 作者: M Mark Simulacrum

Permit constructing Build without executing

上级 a5e56b62
......@@ -326,7 +326,7 @@ pub fn new(config: Config) -> Build {
let rls_info = channel::GitInfo::new(&config, &src.join("src/tools/rls"));
let rustfmt_info = channel::GitInfo::new(&config, &src.join("src/tools/rustfmt"));
Build {
let mut build = Build {
initial_rustc: config.initial_rustc.clone(),
initial_cargo: config.initial_cargo.clone(),
local_rebuild: config.local_rebuild,
......@@ -357,7 +357,27 @@ pub fn new(config: Config) -> Build {
delayed_failures: RefCell::new(Vec::new()),
prerelease_version: Cell::new(None),
tool_artifacts: Default::default(),
};
build.verbose("finding compilers");
cc_detect::find(&mut build);
build.verbose("running sanity check");
sanity::check(&mut build);
// If local-rust is the same major.minor as the current version, then force a local-rebuild
let local_version_verbose = output(
Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
let local_release = local_version_verbose
.lines().filter(|x| x.starts_with("release:"))
.next().unwrap().trim_left_matches("release:").trim();
let my_version = channel::CFG_RELEASE_NUM;
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
build.verbose(&format!("auto-detected local-rebuild {}", local_release));
build.local_rebuild = true;
}
build.verbose("learning about cargo");
metadata::build(&mut build);
build
}
pub fn build_triple(&self) -> &[Interned<String>] {
......@@ -376,24 +396,6 @@ pub fn build(&mut self) {
return clean::clean(self, all);
}
self.verbose("finding compilers");
cc_detect::find(self);
self.verbose("running sanity check");
sanity::check(self);
// If local-rust is the same major.minor as the current version, then force a local-rebuild
let local_version_verbose = output(
Command::new(&self.initial_rustc).arg("--version").arg("--verbose"));
let local_release = local_version_verbose
.lines().filter(|x| x.starts_with("release:"))
.next().unwrap().trim_left_matches("release:").trim();
let my_version = channel::CFG_RELEASE_NUM;
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
self.verbose(&format!("auto-detected local-rebuild {}", local_release));
self.local_rebuild = true;
}
self.verbose("learning about cargo");
metadata::build(self);
let builder = builder::Builder::new(&self);
if let Some(path) = builder.paths.get(0) {
if path == Path::new("nonexistent/path/to/trigger/cargo/metadata") {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册