From 97ca442c0a029b39d930d97d2035d46bba826a69 Mon Sep 17 00:00:00 2001 From: Martijn Bastiaan Date: Fri, 18 Aug 2023 08:26:45 +0200 Subject: [PATCH] Simplify calling cargo in Shake --- bittide-shake/bin/Shake.hs | 6 ++-- bittide-shake/bittide-shake.cabal | 1 - bittide-shake/src/Clash/Shake/Cargo.hs | 47 -------------------------- 3 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 bittide-shake/src/Clash/Shake/Cargo.hs diff --git a/bittide-shake/bin/Shake.hs b/bittide-shake/bin/Shake.hs index 6fd844cc0..34c90e837 100644 --- a/bittide-shake/bin/Shake.hs +++ b/bittide-shake/bin/Shake.hs @@ -23,7 +23,6 @@ import System.Process (readProcess, callProcess) import Paths_bittide_shake -import Clash.Shake.Cargo import Clash.Shake.Extra import Clash.Shake.Flags import Clash.Shake.Vivado @@ -202,7 +201,7 @@ shakeOpts :: ShakeOptions shakeOpts = shakeOptions { shakeFiles = buildDir , shakeChange = ChangeDigest - , shakeVersion = "8" + , shakeVersion = "9" } -- | Run Vivado on given TCL script @@ -333,7 +332,8 @@ main = do -- We build all rust binaries in "firmware-binaries". They are required to -- build bittide-instance because we have instances that includes a binaries. - liftIO $ cargoBuildFirmwareProgram "firmware-binaries" Release + command_ [Cwd "firmware-binaries"] "cargo" ["build", "--release"] + let (buildTool, buildToolArgs) = defaultClashCmd clashBuildDir targetName diff --git a/bittide-shake/bittide-shake.cabal b/bittide-shake/bittide-shake.cabal index 27dd62aa6..c6d131faa 100644 --- a/bittide-shake/bittide-shake.cabal +++ b/bittide-shake/bittide-shake.cabal @@ -97,7 +97,6 @@ library import: common-options hs-source-dirs: src exposed-modules: - Clash.Shake.Cargo Clash.Shake.Extra Clash.Shake.Flags Clash.Shake.Vivado diff --git a/bittide-shake/src/Clash/Shake/Cargo.hs b/bittide-shake/src/Clash/Shake/Cargo.hs deleted file mode 100644 index 082176c5b..000000000 --- a/bittide-shake/src/Clash/Shake/Cargo.hs +++ /dev/null @@ -1,47 +0,0 @@ --- SPDX-FileCopyrightText: 2023 Google LLC --- --- SPDX-License-Identifier: Apache-2.0 -module Clash.Shake.Cargo where - -import Prelude - -import System.Exit -import System.IO -import System.Process - -import qualified Clash.Util.Interpolate as I - -data CargoBuildMode = Release | Debug - deriving Eq - -cargoBuildFirmwareProgram :: - FilePath -> - -- ^ Directory to perform the call in - CargoBuildMode -> - -- ^ release mode? - IO () -cargoBuildFirmwareProgram workingDir release = do - let - cmd = "cargo" - args = "build" : ["--release" | release == Release] - createProc = - (proc cmd args) - { cwd = Just workingDir} - (exitCode, _stdoutOut, stderrOut) <- readCreateProcessWithExitCode createProc "" - - case exitCode of - ExitSuccess -> do - pure () - ExitFailure exitInt -> do - hPutStrLn stderr [I.i| - "#{cmd} #{unwords args}" terminated with exit code #{exitInt}. - - Stderr: - - #{stderrOut} - - Stdout: - - #{_stdoutOut} - |] - exitWith exitCode