Skip to content
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

Enable building clippy in CI #45177

Merged
merged 2 commits into from
Oct 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ impl Step for Miri {

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Clippy {
stage: u32,
host: Interned<String>,
}

Expand All @@ -372,24 +373,28 @@ impl Step for Clippy {

fn make_run(run: RunConfig) {
run.builder.ensure(Clippy {
stage: run.builder.top_stage,
host: run.target,
});
}

/// Runs `cargo test` for clippy.
fn run(self, builder: &Builder) {
let build = builder.build;
let stage = self.stage;
let host = self.host;
let compiler = builder.compiler(1, host);
let compiler = builder.compiler(stage, host);

let _clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
let clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));

// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
// clippy tests need to know about the stage sysroot
cargo.env("SYSROOT", builder.sysroot(compiler));
// clippy tests need to find the driver
cargo.env("CLIPPY_DRIVER_PATH", clippy);

builder.add_rustc_lib_path(compiler, &mut cargo);

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ pub struct Clippy {

impl Step for Clippy {
type Output = PathBuf;
const DEFAULT: bool = false;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
Expand All @@ -411,7 +411,7 @@ impl Step for Clippy {
builder.ensure(ToolBuild {
compiler: self.compiler,
target: self.target,
tool: "clippy",
tool: "clippy-driver",
mode: Mode::Librustc,
path: "src/tools/clippy",
expectation: builder.build.config.toolstate.clippy.passes(ToolState::Compiling),
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy
4 changes: 2 additions & 2 deletions src/tools/toolstate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# There are three states a tool can be in:
# 1. Broken: The tool doesn't build
# 2. Building: The tool builds but its tests are failing
# 2. Compiling: The tool builds but its tests are failing
# 3. Testing: The tool builds and its tests are passing
#
# In the future there will be further states like "Distributing", which
Expand All @@ -26,7 +26,7 @@
miri = "Broken"

# ping @Manishearth @llogiq @mcarton @oli-obk
clippy = "Broken"
clippy = "Compiling"

# ping @nrc
rls = "Testing"
Expand Down