aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBrad Richardson <brichardson@structint.com>2020-04-11 17:27:49 -0500
committerBrad Richardson <brichardson@structint.com>2020-04-12 21:48:23 -0500
commit038ac8587792cdf4d7c6d92efebb56fe00eaf4da (patch)
treec516d9f3c891e959737afe1fdd27ba874fba5b96 /app
parent3a5e426e3103dae2f71732e2a830bd38ffe2c96b (diff)
downloadfpm-038ac8587792cdf4d7c6d92efebb56fe00eaf4da.tar.gz
fpm-038ac8587792cdf4d7c6d92efebb56fe00eaf4da.zip
Enable running the executables from fpm
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs16
1 files 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