summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2021-02-19 12:26:19 +0100
committerTom Smeding <tom@tomsmeding.com>2021-02-19 12:26:19 +0100
commit317f1e27688a082926f39ec897f5a38d01a07ce7 (patch)
tree19417d35e7b2a606fb9a831e7ad505113ba7d696 /Main.hs
parent08f53feceb1edb10f8b3a816021fb580b27e5b4c (diff)
Rebuild
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
index b696241..463a33b 100644
--- a/Main.hs
+++ b/Main.hs
@@ -88,6 +88,14 @@ doBuild (BuildOptions mtarget) = do
old <- targetCheckOld rootdir tg
when old $ targetBuild rootdir tg
+doRebuild :: BuildOptions -> IO ()
+doRebuild (BuildOptions mtarget) = do
+ (rootdir, targets, targetsForName) <- readCachedTargets (const True)
+ toBuild <- maybe (return targets) (targetsToBuild targetsForName) mtarget
+ forM_ toBuild $ useAnyTarget $ \tg -> do
+ targetRemoveBuildArtifacts rootdir tg
+ targetBuild rootdir tg
+
doRun :: RunOptions -> IO ()
doRun (RunOptions mtarget args) = do
(rootdir, targets, targetsForName) <- readCachedTargets (isJust . useAnyTarget targetExecute)
@@ -110,4 +118,5 @@ main = do
Configure -> doConfigure
Clean -> doClean
Build opts -> doBuild opts
+ Rebuild opts -> doRebuild opts
Run opts -> doRun opts