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

fix(xtask): don't use build-std with clippy #1073

Merged
merged 1 commit into from
Feb 19, 2024
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
10 changes: 7 additions & 3 deletions xtask/src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ pub enum Arch {
impl Arch {
pub fn install(&self) -> Result<()> {
let sh = crate::sh()?;
let triple = self.triple();
cmd!(sh, "rustup target add {triple}").run()?;
Ok(())
}

pub fn install_for_build(&self) -> Result<()> {
if self == &Self::X86_64 {
eprintln!("Installing target");
let triple = self.triple();
cmd!(sh, "rustup target add {triple}").run()?;
self.install()?;
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Build {
pub fn run(self) -> Result<()> {
let sh = crate::sh()?;

self.cargo_build.artifact.arch.install()?;
self.cargo_build.artifact.arch.install_for_build()?;

eprintln!("Building kernel");
cmd!(sh, "cargo build")
Expand Down
19 changes: 11 additions & 8 deletions xtask/src/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,32 @@ impl Clippy {
for target in [Arch::X86_64, Arch::Aarch64] {
target.install()?;

let target_args = target.cargo_args();
cmd!(sh, "cargo clippy {target_args...}").run()?;
cmd!(sh, "cargo clippy {target_args...}")
let triple = target.triple();
cmd!(sh, "cargo clippy --target={triple}").run()?;
cmd!(sh, "cargo clippy --target={triple}")
.arg("--no-default-features")
.run()?;
cmd!(sh, "cargo clippy {target_args...}")
cmd!(sh, "cargo clippy --target={triple}")
.arg("--no-default-features")
.arg("--features=acpi,fsgsbase,pci,smp,vga")
.run()?;
// TODO: Enable clippy for newlib
// https://github.com/hermit-os/kernel/issues/470
// cmd!(sh, "cargo clippy {target_args...}")
// cmd!(sh, "cargo clippy --target={triple}")
// .arg("--no-default-features")
// .arg("--features=acpi,fsgsbase,newlib,smp,vga")
// .run()?;
}

{
let target_args = Arch::Riscv64.cargo_args();
cmd!(sh, "cargo clippy {target_args...}")
let target = Arch::Riscv64;
target.install()?;

let triple = target.triple();
cmd!(sh, "cargo clippy --target={triple}")
.arg("--no-default-features")
.run()?;
cmd!(sh, "cargo clippy {target_args...}")
cmd!(sh, "cargo clippy --target={triple}")
.arg("--no-default-features")
.arg("--features=smp,tcp")
.run()?;
Expand Down