-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShakefile.hs
More file actions
29 lines (23 loc) · 830 Bytes
/
Shakefile.hs
File metadata and controls
29 lines (23 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Util
import Development.Shake.Dhall
import System.Directory (getHomeDirectory)
main :: IO ()
main = do
sharedDir <- (<> "/.cache/mr-dhall") <$> getHomeDirectory
shakeArgs shakeOptions{shakeShare = Just sharedDir, shakeChange = ChangeDigest} $ do
"clean" ~> do
putInfo "Cleaning files in _build"
removeFilesAfter sharedDir ["//*"]
removeFilesAfter ".shake" ["//*"]
"generate" ~> do
ds <- getDirectoryFiles "" ["examples/*.dhall"]
let ys = [ d -<.> "mr" | d <- ds]
need ys
"*//*.mr" %> \out -> do
let src = out -<.> "dhall"
needDhall [src]
Stdout result <- cmd "dhall text" "--file" src
writeFile' out result