only perform checks when it needs to build

This commit is contained in:
Luigy Leon 2016-02-19 15:42:42 -05:00
parent d87499deb5
commit f576a8a435

View File

@ -77,6 +77,7 @@ keter cabal noBuild noCopyTo buildArgs = do
collapse' (x:xs) = x : collapse' xs collapse' (x:xs) = x : collapse' xs
collapse' [] = [] collapse' [] = []
unless noBuild $ do
stackQueryRunSuccess <- do stackQueryRunSuccess <- do
(ec,_,_) <- readProcessWithExitCode "stack" ["query"] "" (ec,_,_) <- readProcessWithExitCode "stack" ["query"] ""
return (ec == ExitSuccess) return (ec == ExitSuccess)
@ -85,7 +86,7 @@ keter cabal noBuild noCopyTo buildArgs = do
mStackYaml = lookup "STACK_YAML" env' mStackYaml = lookup "STACK_YAML" env'
useStack = inStackExec || isJust mStackYaml || stackQueryRunSuccess useStack = inStackExec || isJust mStackYaml || stackQueryRunSuccess
unless noBuild $ if useStack if useStack
then do let stackYaml = maybeToList $ fmap ("--stack-yaml="<>) mStackYaml then do let stackYaml = maybeToList $ fmap ("--stack-yaml="<>) mStackYaml
localBinPath = cwd' </> "dist/bin" localBinPath = cwd' </> "dist/bin"
run "stack" $ stackYaml <> ["clean"] run "stack" $ stackYaml <> ["clean"]