Skip to content

Commit

Permalink
Add config file for tools enabling stage1 downloads by default
Browse files Browse the repository at this point in the history
Otherwise no one will be able to find the setting.
  • Loading branch information
jyn514 committed Jan 8, 2021
1 parent c8915ee commit cb5d8c8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
6 changes: 6 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,12 @@ changelog-seen = 2
# as generics will be preserved in symbols (rather than erased into opaque T).
#new-symbol-mangling = false

# Download the stage 1 compiler from CI, rather than building it from source.
# If you are not on a master commit, this will download the most recent commit
# that made it to master. This will always rebuild if you have local
# modifications to `compiler/` since the most recent commit.
#download_stage1 = false

# =============================================================================
# Options for specific targets
#
Expand Down
16 changes: 16 additions & 0 deletions src/bootstrap/defaults/config.tools.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# These defaults are meant for contributors to tools which build on the
# compiler, but do not modify it directly.
[rust]
# This enables `RUSTC_LOG=debug`, avoiding confusing situations
# where adding `debug!()` appears to do nothing.
# However, it makes running the compiler slightly slower.
debug-logging = true
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
incremental = true
# This avoids recompiling rustc if you haven't changed it
download_stage1 = true

[llvm]
# Will download LLVM from CI if available on your platform (Linux only for now)
# https://github.com/rust-lang/rust/issues/77084 tracks support for more platforms
download-ci-llvm = "if-available"
20 changes: 17 additions & 3 deletions src/bootstrap/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub enum Profile {
Compiler,
Codegen,
Library,
Tools,
User,
}

Expand All @@ -24,15 +25,16 @@ impl Profile {
pub fn all() -> impl Iterator<Item = Self> {
use Profile::*;
// N.B. these are ordered by how they are displayed, not alphabetically
[Library, Compiler, Codegen, User].iter().copied()
[Library, Compiler, Codegen, Tools, User].iter().copied()
}

pub fn purpose(&self) -> String {
use Profile::*;
match self {
Library => "Contribute to the standard library",
Compiler => "Contribute to the compiler or rustdoc",
Compiler => "Contribute to the compiler itself",
Codegen => "Contribute to the compiler, and also modify LLVM or codegen",
Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)",
User => "Install Rust from source",
}
.to_string()
Expand All @@ -53,9 +55,12 @@ impl FromStr for Profile {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"lib" | "library" => Ok(Profile::Library),
"compiler" | "rustdoc" => Ok(Profile::Compiler),
"compiler" => Ok(Profile::Compiler),
"llvm" | "codegen" => Ok(Profile::Codegen),
"maintainer" | "user" => Ok(Profile::User),
"tools" | "tool" | "rustdoc" | "clippy" | "miri" | "rustfmt" | "rls" => {
Ok(Profile::Tools)
}
_ => Err(format!("unknown profile: '{}'", s)),
}
}
Expand All @@ -68,6 +73,7 @@ impl fmt::Display for Profile {
Profile::Codegen => write!(f, "codegen"),
Profile::Library => write!(f, "library"),
Profile::User => write!(f, "user"),
Profile::Tools => write!(f, "tools"),
}
}
}
Expand Down Expand Up @@ -103,6 +109,14 @@ pub fn setup(src_path: &Path, profile: Profile) {

let suggestions = match profile {
Profile::Codegen | Profile::Compiler => &["check", "build", "test"][..],
Profile::Tools => &[
"check",
"build",
"test src/test/rustdoc*",
"test src/tools/clippy",
"test src/tools/miri",
"test src/tools/rustfmt",
],
Profile::Library => &["check", "build", "test library/std", "doc"],
Profile::User => &["dist", "build"],
};
Expand Down

0 comments on commit cb5d8c8

Please sign in to comment.