aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-05-01 19:53:43 +0200
committerDaniel Gröber <dxld@darkboxed.org>2020-05-01 19:57:48 +0200
commit7ce6b4fcefec5cf56e422a3072ef148424bd586b (patch)
treead62ff23b2a46b02a26301443081f19b31a9cc97 /src/CabalHelper/Compiletime
parent296cb3d524098ec25fd3074c9318d5e3a3898dc5 (diff)
Add call to addDependentFile to track TH dependencies
Cabal still doesn't really know about these depencies and will only start GHC if it needs to rebuild for other reasons. However! Since all the files we pull in are source files for the library anyways it all works out.
Diffstat (limited to 'src/CabalHelper/Compiletime')
-rw-r--r--src/CabalHelper/Compiletime/Data.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/CabalHelper/Compiletime/Data.hs b/src/CabalHelper/Compiletime/Data.hs
index 9586c77..8b47997 100644
--- a/src/CabalHelper/Compiletime/Data.hs
+++ b/src/CabalHelper/Compiletime/Data.hs
@@ -10,7 +10,6 @@
-- http://www.apache.org/licenses/LICENSE-2.0
{-# LANGUAGE TemplateHaskell, ScopedTypeVariables, CPP #-}
-{-# OPTIONS_GHC -fforce-recomp #-}
{-|
Module : CabalHelper.Compiletime.Data
@@ -30,6 +29,7 @@ import qualified Data.ByteString.UTF8 as UTF8
import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString.Lazy.UTF8 as LUTF8
import Language.Haskell.TH
+import Language.Haskell.TH.Syntax (addDependentFile)
import System.Directory
import System.FilePath
import System.IO.Temp
@@ -86,7 +86,9 @@ runtimeSources = $(
, ("Shared/InterfaceTypes.hs")
]
in do
- contents <- mapM (\lf -> runIO (LBS.readFile lf)) $ map snd files
+ contents <- forM (map snd files) $ \lf -> do
+ addDependentFile lf
+ runIO (LBS.readFile lf)
let hashes = map (bytestringDigest . sha256) contents
let top_hash = showDigest $ sha256 $ LBS.concat hashes