-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add preliminary support for incremental compilation to rustbuild.py #38072
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ pub fn build_rules(build: &Build) -> Rules { | |
// | ||
// To handle this we do a bit of dynamic dispatch to see what the dependency | ||
// is. If we're building a LLVM for the build triple, then we don't actually | ||
// have any dependencies! To do that we return a dependency on the "dummy" | ||
// have any dependencies! To do that we return a dependency on the `Step::noop()` | ||
// target which does nothing. | ||
// | ||
// If we're build a cross-compiled LLVM, however, we need to assemble the | ||
|
@@ -104,7 +104,7 @@ pub fn build_rules(build: &Build) -> Rules { | |
.host(true) | ||
.dep(move |s| { | ||
if s.target == build.config.build { | ||
dummy(s, build) | ||
Step::noop() | ||
} else { | ||
s.target(&build.config.build) | ||
} | ||
|
@@ -115,14 +115,11 @@ pub fn build_rules(build: &Build) -> Rules { | |
// going on here. You can check out the API docs below and also see a bunch | ||
// more examples of rules directly below as well. | ||
|
||
// dummy rule to do nothing, useful when a dep maps to no deps | ||
rules.build("dummy", "path/to/nowhere"); | ||
|
||
// the compiler with no target libraries ready to go | ||
rules.build("rustc", "src/rustc") | ||
.dep(move |s| { | ||
if s.stage == 0 { | ||
dummy(s, build) | ||
Step::noop() | ||
} else { | ||
s.name("librustc") | ||
.host(&build.config.build) | ||
|
@@ -165,7 +162,7 @@ pub fn build_rules(build: &Build) -> Rules { | |
.dep(move |s| s.name("rustc").host(&build.config.build).target(s.host)) | ||
.dep(move |s| { | ||
if s.host == build.config.build { | ||
dummy(s, build) | ||
Step::noop() | ||
} else { | ||
s.host(&build.config.build) | ||
} | ||
|
@@ -183,7 +180,7 @@ pub fn build_rules(build: &Build) -> Rules { | |
.dep(|s| s.name("libstd")) | ||
.dep(move |s| { | ||
if s.host == build.config.build { | ||
dummy(s, build) | ||
Step::noop() | ||
} else { | ||
s.host(&build.config.build) | ||
} | ||
|
@@ -203,7 +200,7 @@ pub fn build_rules(build: &Build) -> Rules { | |
.dep(move |s| s.name("llvm").host(&build.config.build).stage(0)) | ||
.dep(move |s| { | ||
if s.host == build.config.build { | ||
dummy(s, build) | ||
Step::noop() | ||
} else { | ||
s.host(&build.config.build) | ||
} | ||
|
@@ -233,7 +230,7 @@ pub fn build_rules(build: &Build) -> Rules { | |
if s.target.contains("android") { | ||
s.name("android-copy-libs") | ||
} else { | ||
dummy(s, build) | ||
Step::noop() | ||
} | ||
}) | ||
.default(true) | ||
|
@@ -514,12 +511,6 @@ pub fn build_rules(build: &Build) -> Rules { | |
|
||
rules.verify(); | ||
return rules; | ||
|
||
fn dummy<'a>(s: &Step<'a>, build: &'a Build) -> Step<'a> { | ||
s.name("dummy").stage(0) | ||
.target(&build.config.build) | ||
.host(&build.config.build) | ||
} | ||
} | ||
|
||
#[derive(PartialEq, Eq, Hash, Clone, Debug)] | ||
|
@@ -543,6 +534,10 @@ struct Step<'a> { | |
} | ||
|
||
impl<'a> Step<'a> { | ||
fn noop() -> Step<'a> { | ||
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. 👍 much nicer |
||
Step { name: "", stage: 0, host: "", target: "" } | ||
} | ||
|
||
/// Creates a new step which is the same as this, except has a new name. | ||
fn name(&self, name: &'a str) -> Step<'a> { | ||
Step { name: name, ..*self } | ||
|
@@ -738,6 +733,9 @@ impl<'a> Rules<'a> { | |
if self.rules.contains_key(&dep.name) || dep.name.starts_with("default:") { | ||
continue | ||
} | ||
if dep == Step::noop() { | ||
continue | ||
} | ||
panic!("\ | ||
|
||
invalid rule dependency graph detected, was a rule added and maybe typo'd? | ||
|
@@ -864,6 +862,7 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd? | |
// of what we need to do. | ||
let mut order = Vec::new(); | ||
let mut added = HashSet::new(); | ||
added.insert(Step::noop()); | ||
for step in steps.iter().cloned() { | ||
self.fill(step, &mut order, &mut added); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Aha! I found out where we actually read this. Ideally we wouldn't need
--local-rust-root
here because--enable-local-rebuild
should say "get from PATH by default".Let's fix that bug later.
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.
@alexcrichton actually, I think the configure script does fetch from path by default -- I just used
--local-rust-root
because I have a differentrustc
in my path that takes precedence over rustupThere 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.
oh, but I see that bootstrap doesn't. ok.