Skip to content

Commit

Permalink
Support for extra-package-dbs in 'stack ghci'
Browse files Browse the repository at this point in the history
Extra package dbs support for GHC_PACKAGE_PATH
  • Loading branch information
vigoo committed Nov 12, 2015
1 parent 33462ab commit f2f50a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Stack/GhcPkg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ getCabalPkgVer menv wc =
maybe (throwM $ Couldn'tFindPkgId cabalPackageName) return

-- | Get the value for GHC_PACKAGE_PATH
mkGhcPackagePath :: Bool -> Path Abs Dir -> Path Abs Dir -> Path Abs Dir -> Text
mkGhcPackagePath locals localdb deps globaldb =
mkGhcPackagePath :: Bool -> Path Abs Dir -> Path Abs Dir -> [Path Abs Dir] -> Path Abs Dir -> Text
mkGhcPackagePath locals localdb deps extras globaldb =
T.pack $ intercalate [searchPathSeparator] $ concat
[ [toFilePathNoTrailingSep localdb | locals]
, [toFilePathNoTrailingSep deps]
, [toFilePathNoTrailingSep db | db <- reverse extras]
, [toFilePathNoTrailingSep globaldb]
]
3 changes: 2 additions & 1 deletion src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ setupEnv mResolveMissingGHC = do
localdb <- runReaderT packageDatabaseLocal envConfig0
createDatabase menv wc localdb
globaldb <- getGlobalDB menv wc
let mkGPP locals = mkGhcPackagePath locals localdb deps globaldb
extras <- runReaderT packageDatabaseExtra envConfig0
let mkGPP locals = mkGhcPackagePath locals localdb deps extras globaldb

distDir <- runReaderT distRelativeDir envConfig0

Expand Down
7 changes: 5 additions & 2 deletions src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ pathCmd keys go =
menv <- getMinimalEnvOverride
snap <- packageDatabaseDeps
local <- packageDatabaseLocal
extra <- packageDatabaseExtra
global <- getGlobalDB menv =<< getWhichCompiler
snaproot <- installationRootDeps
localroot <- installationRootLocal
Expand All @@ -394,7 +395,8 @@ pathCmd keys go =
global
snaproot
localroot
distDir))))
distDir
extra))))

-- | Passed to all the path printers as a source of info.
data PathInfo = PathInfo
Expand All @@ -406,6 +408,7 @@ data PathInfo = PathInfo
,piSnapRoot :: Path Abs Dir
,piLocalRoot :: Path Abs Dir
,piDistDir :: Path Rel Dir
,piExtraDbs :: [Path Abs Dir]
}

-- | The paths of interest to a user. The first tuple string is used
Expand Down Expand Up @@ -467,7 +470,7 @@ paths =
T.pack (toFilePathNoTrailingSep (piGlobalDb pi)))
, ( "GHC_PACKAGE_PATH environment variable"
, "ghc-package-path"
, \pi -> mkGhcPackagePath True (piLocalDb pi) (piSnapDb pi) (piGlobalDb pi))
, \pi -> mkGhcPackagePath True (piLocalDb pi) (piSnapDb pi) (piExtraDbs pi) (piGlobalDb pi))
, ( "Snapshot installation root"
, "snapshot-install-root"
, \pi ->
Expand Down

0 comments on commit f2f50a6

Please sign in to comment.