Skip to content

Commit 038ac85

Browse files
author
Brad Richardson
committed
Enable running the executables from fpm
1 parent 3a5e426 commit 038ac85

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/Main.hs

+13-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Options.Applicative ( Parser
2828
import System.Directory ( doesDirectoryExist
2929
, doesFileExist
3030
)
31+
import System.Process ( runCommand )
3132
import Toml ( TomlCodec
3233
, (.=)
3334
)
@@ -74,13 +75,22 @@ main = do
7475

7576
app :: Arguments -> AppSettings -> IO ()
7677
app args settings = case command' args of
77-
Run -> putStrLn "Run"
78-
Test -> putStrLn "Test"
7978
Build -> build settings
79+
Run -> do
80+
build settings
81+
let buildPrefix = appSettingsBuildPrefix settings
82+
let
83+
executableNames = map
84+
(\Executable { executableSourceDir = sourceDir, executableMainFile = mainFile, executableName = name } ->
85+
sourceDir </> name
86+
)
87+
(appSettingsExecutables settings)
88+
let executables = map (buildPrefix </>) executableNames
89+
mapM_ runCommand executables
90+
Test -> putStrLn "Test"
8091

8192
build :: AppSettings -> IO ()
8293
build settings = do
83-
putStrLn "Building"
8494
let compiler = appSettingsCompiler settings
8595
let projectName = appSettingsProjectName settings
8696
let buildPrefix = appSettingsBuildPrefix settings

0 commit comments

Comments
 (0)