From 038ac8587792cdf4d7c6d92efebb56fe00eaf4da Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Sat, 11 Apr 2020 17:27:49 -0500 Subject: Enable running the executables from fpm --- app/Main.hs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 9438eb2..75b5e5f 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -28,6 +28,7 @@ import Options.Applicative ( Parser import System.Directory ( doesDirectoryExist , doesFileExist ) +import System.Process ( runCommand ) import Toml ( TomlCodec , (.=) ) @@ -74,13 +75,22 @@ main = do app :: Arguments -> AppSettings -> IO () app args settings = case command' args of - Run -> putStrLn "Run" - Test -> putStrLn "Test" Build -> build settings + Run -> do + build settings + let buildPrefix = appSettingsBuildPrefix settings + let + executableNames = map + (\Executable { executableSourceDir = sourceDir, executableMainFile = mainFile, executableName = name } -> + sourceDir name + ) + (appSettingsExecutables settings) + let executables = map (buildPrefix ) executableNames + mapM_ runCommand executables + Test -> putStrLn "Test" build :: AppSettings -> IO () build settings = do - putStrLn "Building" let compiler = appSettingsCompiler settings let projectName = appSettingsProjectName settings let buildPrefix = appSettingsBuildPrefix settings -- cgit v1.2.3