-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up dependency tracking in Rustbuild [2/2] #52036
Changes from all commits
c0af0b0
c22c709
86e34cd
de3ec8d
e792d1d
b585893
9681e13
5ae40be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,6 @@ use serde_json; | |
use util::{exe, libdir, is_dylib, CiEnv}; | ||
use {Compiler, Mode}; | ||
use native; | ||
use tool; | ||
|
||
use cache::{INTERNER, Interned}; | ||
use builder::{Step, RunConfig, ShouldRun, Builder}; | ||
|
@@ -107,8 +106,6 @@ impl Step for Std { | |
copy_musl_third_party_objects(builder, target, &libdir); | ||
} | ||
|
||
let out_dir = builder.cargo_out(compiler, Mode::Std, target); | ||
builder.clear_if_dirty(&out_dir, &builder.rustc(compiler)); | ||
let mut cargo = builder.cargo(compiler, Mode::Std, target, "build"); | ||
std_cargo(builder, &compiler, target, &mut cargo); | ||
|
||
|
@@ -246,11 +243,7 @@ impl Step for StdLink { | |
copy_apple_sanitizer_dylibs(builder, &builder.native_dir(target), "osx", &libdir); | ||
} | ||
|
||
builder.ensure(tool::CleanTools { | ||
compiler: target_compiler, | ||
target, | ||
cause: Mode::Std, | ||
}); | ||
builder.cargo(target_compiler, Mode::ToolStd, target, "clean"); | ||
} | ||
} | ||
|
||
|
@@ -387,8 +380,6 @@ impl Step for Test { | |
return; | ||
} | ||
|
||
let out_dir = builder.cargo_out(compiler, Mode::Test, target); | ||
builder.clear_if_dirty(&out_dir, &libstd_stamp(builder, compiler, target)); | ||
let mut cargo = builder.cargo(compiler, Mode::Test, target, "build"); | ||
test_cargo(builder, &compiler, target, &mut cargo); | ||
|
||
|
@@ -448,11 +439,8 @@ impl Step for TestLink { | |
target)); | ||
add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), | ||
&libtest_stamp(builder, compiler, target)); | ||
builder.ensure(tool::CleanTools { | ||
compiler: target_compiler, | ||
target, | ||
cause: Mode::Test, | ||
}); | ||
|
||
builder.cargo(target_compiler, Mode::ToolTest, target, "clean"); | ||
} | ||
} | ||
|
||
|
@@ -519,9 +507,6 @@ impl Step for Rustc { | |
compiler: builder.compiler(self.compiler.stage, builder.config.build), | ||
target: builder.config.build, | ||
}); | ||
let cargo_out = builder.cargo_out(compiler, Mode::Rustc, target); | ||
builder.clear_if_dirty(&cargo_out, &libstd_stamp(builder, compiler, target)); | ||
builder.clear_if_dirty(&cargo_out, &libtest_stamp(builder, compiler, target)); | ||
|
||
let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "build"); | ||
rustc_cargo(builder, &mut cargo); | ||
|
@@ -613,11 +598,7 @@ impl Step for RustcLink { | |
target)); | ||
add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), | ||
&librustc_stamp(builder, compiler, target)); | ||
builder.ensure(tool::CleanTools { | ||
compiler: target_compiler, | ||
target, | ||
cause: Mode::Rustc, | ||
}); | ||
builder.cargo(target_compiler, Mode::ToolRustc, target, "clean"); | ||
} | ||
} | ||
|
||
|
@@ -674,7 +655,6 @@ impl Step for CodegenBackend { | |
} | ||
|
||
let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); | ||
builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, is this change required? I'd expect that if we change rustc crates we need this in order for the codegen backends to be properly rebuilt. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I guess this is being handled by |
||
|
||
let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "rustc"); | ||
cargo.arg("--manifest-path") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, is this (and similar statements below) actually necessary? I would've hoped this would happen on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. It looks like some steps are missed when we don't explicitly call
Builder::cargo
here. i.e running./x.py test src/bootstrap
without doing this shows that some steps were actually not called. I'm not completely sure about this though, maybe I'm missing something.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step resolution shouldn't depend on files existing on the system - do you happen to have a concrete example? If we actually do need this then can we factor out the cleaning logic from
Builder::cargo
and call that separately here? It feels a little odd to be creating the full command and then not running it (i.e., using implicit side-effects).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't feel like dealing with this though feel free to let me know -- I'm fine with leaving these in for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah,
i.e
removing bothBuilder::cargo
https://github.com/rust-lang/rust/pull/52036/files#diff-fa9668c926a2788f7849514fe3ed66a9R248 forStdLink
and https://github.com/rust-lang/rust/pull/52036/files#diff-fa9668c926a2788f7849514fe3ed66a9R446 forTestLink
then doing./x.py test src/bootstrap
, Assertionrust/src/bootstrap/builder.rs
Line 1660 in 1ecf692
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let's leave this as is for now and look into the details later -- it seems fine to leave this somewhat half done pending a more thorough investigation as to how exactly the dependency edge is created.