-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add xtask for (crudely) checking license headers
- Loading branch information
Showing
7 changed files
with
262 additions
and
70 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
use std::process::Command; | ||
|
||
use anyhow::{bail, Result}; | ||
|
||
use crate::util::*; | ||
|
||
pub(crate) fn cmd_clippy(strict: bool) -> Result<()> { | ||
let wroot = workspace_root()?; | ||
|
||
let run_clippy = |args: &[&str]| -> Result<bool> { | ||
let mut cmd = Command::new("cargo"); | ||
cmd.arg("clippy").arg("--no-deps").args(args).current_dir(&wroot); | ||
|
||
if strict { | ||
cmd.args(["--", "-Dwarnings"]); | ||
} | ||
|
||
let status = cmd.spawn()?.wait()?; | ||
Ok(!status.success()) | ||
}; | ||
|
||
let mut failed = false; | ||
|
||
// Everything in the workspace (including tests, etc) | ||
failed |= run_clippy(&["--workspace", "--all-targets"])?; | ||
|
||
// Check the server as it is built for production | ||
failed |= | ||
run_clippy(&["-p", "propolis-server", "--features", "omicron-build"])?; | ||
|
||
// Check the Falcon bits | ||
failed |= run_clippy(&["-p", "propolis-server", "--features", "falcon"])?; | ||
|
||
// Check the mock server | ||
failed |= | ||
run_clippy(&["-p", "propolis-server", "--features", "mock-only"])?; | ||
|
||
if failed { | ||
bail!("Clippy failures detected") | ||
} | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.