Refactoring to use cabal-helper-wrapper

This turned out to be quite involved but save for this huge commit it's
actually quite awesome and squashes quite a few bugs and nasty
problems (hopefully). Most importantly we now have native cabal
component support without the user having to do anything to get it!

To do this we traverse imports starting from each component's
entrypoints (library modules or Main source file for executables) and
use this information to find which component's options each module will
build with. Under the assumption that these modules have to build with
every component they're used in we can now just pick one.

Quite a few internal assumptions have been invalidated by this
change. Most importantly the runGhcModT* family of cuntions now change
the current working directory to `cradleRootDir`.
This commit is contained in:
Daniel Gröber
2015-03-03 21:12:43 +01:00
parent 7438539ca5
commit 82bb0090c0
43 changed files with 1951 additions and 1844 deletions

View File

@@ -1,6 +1,5 @@
module Language.Haskell.GhcMod.Modules (modules) where
import Control.Applicative ((<$>))
import qualified GHC as G
import Language.Haskell.GhcMod.Convert
import Language.Haskell.GhcMod.Monad
@@ -10,5 +9,7 @@ import Module (moduleNameString)
----------------------------------------------------------------
-- | Listing installed modules.
modules :: IOish m => GhcModT m String
modules = convert' =<< map moduleNameString . listVisibleModuleNames <$> G.getSessionDynFlags
modules :: (IOish m, GmEnv m) => m String
modules = do
dflags <- runGmPkgGhc G.getSessionDynFlags
convert' $ map moduleNameString $ listVisibleModuleNames dflags