Recache cabal-helper stuff when cabal-helper-* executable changes

This commit is contained in:
Daniel Gröber
2015-03-06 15:48:26 +01:00
parent c05bd816e7
commit e23772b1ed
3 changed files with 32 additions and 26 deletions

View File

@@ -80,18 +80,17 @@ data CabalHelper = CabalHelper {
cabalHelper :: (MonadIO m, GmEnv m) => m CabalHelper
cabalHelper = withCabal $ do
Cradle {..} <- cradle
let cmds = [ "entrypoints"
, "source-dirs"
, "ghc-options"
, "ghc-src-options"
, "ghc-pkg-options" ]
distdir = cradleRootDir </> "dist"
Cradle {..} <- cradle
exe <- liftIO $ findLibexecExe "cabal-helper-wrapper"
let distdir = cradleRootDir </> "dist"
res <- liftIO $ cached cradleRootDir (cabalHelperCache cmds) $ do
hexe <- liftIO $ readProcess exe [distdir, "print-exe"] ""
res <- liftIO $ cached cradleRootDir (cabalHelperCache hexe cmds) $ do
out <- readProcess exe (distdir:cmds) ""
evaluate (read out) `E.catch`
\(SomeException _) -> error "cabalHelper: read failed"

View File

@@ -233,9 +233,10 @@ cabalBuildPlatform = dropWhileEnd isSpace $ unsafePerformIO $
packageCache :: String
packageCache = "package.cache"
cabalHelperCache :: [String] -> Cached [String] [Maybe GmCabalHelperResponse]
cabalHelperCache cmds = Cached {
inputFiles = [setupConfigPath],
cabalHelperCache ::
FilePath -> [String] -> Cached [String] [Maybe GmCabalHelperResponse]
cabalHelperCache cabalHelperExe cmds = Cached {
inputFiles = [cabalHelperExe, setupConfigPath],
inputData = cmds,
cacheFile = setupConfigPath <.> "ghc-mod.cabal-helper"
}