From a01ee644a8eb25ac027ca3a7b625ea9584fcd2f2 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Mon, 2 Oct 2023 08:45:45 +0200 Subject: [PATCH] Remove fancy emojis from Setup.hs --- cddl/Setup.hs | 123 ++++++++++++++++++++++++++------------------------ 1 file changed, 64 insertions(+), 59 deletions(-) diff --git a/cddl/Setup.hs b/cddl/Setup.hs index 060b82609d4..615b5353821 100644 --- a/cddl/Setup.hs +++ b/cddl/Setup.hs @@ -1,70 +1,75 @@ import Prelude -import Data.Maybe - ( fromJust - ) -import Distribution.Simple - ( Args - , UserHooks (..) - , defaultMainWithHooks - , simpleUserHooks - ) -import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo (..), - ) -import Distribution.Simple.Setup - ( BuildFlags (..) - , ConfigFlags (..) - , fromFlag - ) -import Distribution.Simple.UserHooks - ( UserHooks (..) - ) -import Distribution.Simple.Utils - ( rawSystemExit - ) -import System.Directory - ( getCurrentDirectory - ) +import Data.Maybe ( + fromJust, + ) +import Distribution.Simple ( + Args, + UserHooks (..), + defaultMainWithHooks, + simpleUserHooks, + ) +import Distribution.Simple.LocalBuildInfo ( + LocalBuildInfo (..), + ) +import Distribution.Simple.Setup ( + BuildFlags (..), + ConfigFlags (..), + fromFlag, + ) +import Distribution.Simple.UserHooks ( + UserHooks (..), + ) +import Distribution.Simple.Utils ( + rawSystemExit, + ) +import System.Directory ( + getCurrentDirectory, + ) import qualified Distribution.PackageDescription as Pkg main :: IO () main = - defaultMainWithHooks - simpleUserHooks - { confHook = rustConfHook - , buildHook = rustBuildHook - } + defaultMainWithHooks + simpleUserHooks + { confHook = rustConfHook + , buildHook = rustBuildHook + } -rustConfHook - :: (Pkg.GenericPackageDescription, Pkg.HookedBuildInfo) - -> ConfigFlags - -> IO LocalBuildInfo +rustConfHook :: + (Pkg.GenericPackageDescription, Pkg.HookedBuildInfo) -> + ConfigFlags -> + IO LocalBuildInfo rustConfHook (description, buildInfo) flags = do - localBuildInfo <- confHook simpleUserHooks (description, buildInfo) flags - let packageDescription = localPkgDescr localBuildInfo - let library = fromJust $ Pkg.library packageDescription - let libraryBuildInfo = Pkg.libBuildInfo library - dir <- getCurrentDirectory - return localBuildInfo - { localPkgDescr = packageDescription - { Pkg.library = Just library - { Pkg.libBuildInfo = libraryBuildInfo - { Pkg.extraLibDirs = (dir ++ "/target/release") : Pkg.extraLibDirs libraryBuildInfo - } - } - } - } + localBuildInfo <- confHook simpleUserHooks (description, buildInfo) flags + let packageDescription = localPkgDescr localBuildInfo + let library = fromJust $ Pkg.library packageDescription + let libraryBuildInfo = Pkg.libBuildInfo library + dir <- getCurrentDirectory + return + localBuildInfo + { localPkgDescr = + packageDescription + { Pkg.library = + Just + library + { Pkg.libBuildInfo = + libraryBuildInfo + { Pkg.extraLibDirs = (dir ++ "/target/release") : Pkg.extraLibDirs libraryBuildInfo + } + } + } + } -rustBuildHook - :: Pkg.PackageDescription - -> LocalBuildInfo - -> UserHooks - -> BuildFlags - -> IO () +rustBuildHook :: + Pkg.PackageDescription -> + LocalBuildInfo -> + UserHooks -> + BuildFlags -> + IO () rustBuildHook description localBuildInfo hooks flags = do - putStrLn "🦀 Compiling Rust dependencies..." - putStrLn "🦀 cargo build --release" - rawSystemExit (fromFlag $ buildVerbosity flags) "cargo" ["build", "--release"] - buildHook simpleUserHooks description localBuildInfo hooks flags + putStrLn "[rust] Compiling Rust dependencies..." + putStrLn "[rust] cargo build --release" + rawSystemExit (fromFlag $ buildVerbosity flags) "cargo" ["build", "--release"] + buildHook simpleUserHooks description localBuildInfo hooks flags