From 9b286cc4e153d6a59e26e12a46c73ef97f66f462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Wed, 12 Aug 2015 09:04:09 +0200 Subject: [PATCH] Fix cabal-helper >= 0.5 --- Language/Haskell/GhcMod/CabalHelper.hs | 9 ++++++--- ghc-mod.cabal | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Language/Haskell/GhcMod/CabalHelper.hs b/Language/Haskell/GhcMod/CabalHelper.hs index ac5bf39..e434abb 100644 --- a/Language/Haskell/GhcMod/CabalHelper.hs +++ b/Language/Haskell/GhcMod/CabalHelper.hs @@ -125,6 +125,10 @@ withCabal :: (IOish m, GmEnv m, GmLog m) => m a -> m a withCabal action = do crdl <- cradle opts <- options + + let projdir = cradleRootDir crdl + distdir = projdir "dist" + mCabalFile <- liftIO $ timeFile `traverse` cradleCabalFile crdl mCabalConfig <- liftIO $ timeMaybe (setupConfigFile crdl) @@ -133,8 +137,7 @@ withCabal action = do pkgDbStackOutOfSync <- case mCusPkgDbStack of Just cusPkgDbStack -> do - let root = cradleRootDir crdl - pkgDb <- runQuery' (helperProgs opts) root (root "dist") $ + pkgDb <- runQuery' (helperProgs opts) projdir distdir $ map chPkgToGhcPkg <$> packageDbStack return $ pkgDb /= cusPkgDbStack @@ -161,7 +164,7 @@ withCabal action = do ++ map pkgDbArg cusPkgStack liftIO $ void $ readProcess (T.cabalProgram opts) ("configure":progOpts) "" gmLog GmDebug "" $ strDoc $ "writing Cabal autogen files" - liftIO $ writeAutogenFiles $ cradleRootDir crdl "dist" + liftIO $ writeAutogenFiles readProcess projdir distdir action pkgDbArg :: GhcPkgDb -> String diff --git a/ghc-mod.cabal b/ghc-mod.cabal index 76d700e..b935bd0 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -132,7 +132,7 @@ Library , bytestring , cereal >= 0.4 , containers - , cabal-helper == 0.4.* && >= 0.4.0.0 + , cabal-helper == 0.5.* && >= 0.5.0.0 , deepseq , directory , filepath