Skip to content

Commit

Permalink
fix(xtask): don't use build-std with clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Feb 19, 2024
1 parent d0439ea commit e6104d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
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

0 comments on commit e6104d4

Please sign in to comment.