82bb0090c0
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`.
53 lines
1.1 KiB
Haskell
53 lines
1.1 KiB
Haskell
-- | Low level access to the ghc-mod library.
|
|
|
|
module Language.Haskell.GhcMod.Internal (
|
|
-- * Types
|
|
GHCOption
|
|
, Package
|
|
, PackageBaseName
|
|
, PackageVersion
|
|
, PackageId
|
|
, IncludeDir
|
|
-- * Various Paths
|
|
, ghcLibDir
|
|
, ghcModExecutable
|
|
-- * Logging
|
|
, withLogger
|
|
, setNoWarningFlags
|
|
, setAllWarningFlags
|
|
-- * Environment, state and logging
|
|
, GhcModEnv(..)
|
|
, GhcModState
|
|
, CompilerMode(..)
|
|
, GhcModLog
|
|
-- * Monad utilities
|
|
, runGhcModT'
|
|
, hoistGhcModT
|
|
-- ** Accessing 'GhcModEnv' and 'GhcModState'
|
|
, options
|
|
, cradle
|
|
, getCompilerMode
|
|
, setCompilerMode
|
|
, withOptions
|
|
-- * 'GhcModError'
|
|
, gmeDoc
|
|
-- * World
|
|
, World
|
|
, getCurrentWorld
|
|
, didWorldChange
|
|
) where
|
|
|
|
import GHC.Paths (libdir)
|
|
|
|
import Language.Haskell.GhcMod.DynFlags
|
|
import Language.Haskell.GhcMod.Error
|
|
import Language.Haskell.GhcMod.Logger
|
|
import Language.Haskell.GhcMod.Monad
|
|
import Language.Haskell.GhcMod.Types
|
|
import Language.Haskell.GhcMod.Utils
|
|
import Language.Haskell.GhcMod.World
|
|
|
|
-- | Obtaining the directory for ghc system libraries.
|
|
ghcLibDir :: FilePath
|
|
ghcLibDir = libdir
|