Skip to content

Commit

Permalink
Do not rebuild LLVM for x.py check
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Apr 18, 2018
1 parent f31c01c commit 1db9fab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/bootstrap/builder.rs
Expand Up @@ -552,6 +552,12 @@ impl<'a> Builder<'a> {
.arg("--target")
.arg(target);

// Set a flag for `check` so that certain build scripts can do less work
// (e.g. not building/requiring LLVM).
if cmd == "check" {
cargo.env("RUST_CHECK", "1");
}

// If we were invoked from `make` then that's already got a jobserver
// set up for us so no need to tell Cargo about jobs all over again.
if env::var_os("MAKEFLAGS").is_none() && env::var_os("MFLAGS").is_none() {
Expand Down
5 changes: 2 additions & 3 deletions src/bootstrap/check.rs
Expand Up @@ -11,7 +11,6 @@
//! Implementation of compiling the compiler and standard library, in "check" mode.

use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot};
use compile::build_codegen_backend;
use builder::{RunConfig, Builder, ShouldRun, Step};
use {Compiler, Mode};
use cache::{INTERNER, Interned};
Expand Down Expand Up @@ -138,11 +137,11 @@ impl Step for CodegenBackend {
let backend = self.backend;

let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "check");
let mut features = build.rustc_features().to_string();
let features = build.rustc_features().to_string();
cargo.arg("--manifest-path").arg(build.src.join("src/librustc_trans/Cargo.toml"));
rustc_cargo_env(build, &mut cargo);

features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
// We won't build LLVM if it's not available, as it shouldn't affect `check`.

let _folder = build.fold_output(|| format!("stage{}-rustc_trans", compiler.stage));
run_cargo(build,
Expand Down
5 changes: 5 additions & 0 deletions src/librustc_llvm/build.rs
Expand Up @@ -28,6 +28,11 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
}

fn main() {
if env::var_os("RUST_CHECK").is_some() {
// If we're just running `check`, there's no need for LLVM to be built.
return;
}

let target = env::var("TARGET").expect("TARGET was not set");
let llvm_config = env::var_os("LLVM_CONFIG")
.map(PathBuf::from)
Expand Down

0 comments on commit 1db9fab

Please sign in to comment.