Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions src/Stack/Ghci.hs
Original file line number Diff line number Diff line change
Expand Up @@ -916,32 +916,37 @@ makeGhciPkgInfo ::
-> RIO env GhciPkgInfo
makeGhciPkgInfo installMap installedMap locals addPkgs mfileTargets pkgDesc = do
bopts <- view buildOptsL
let pkg = pkgDesc.package
let package = pkgDesc.package
cabalFP = pkgDesc.cabalFP
target = pkgDesc.target
name = pkg.name
(mods, files, opts) <-
getPackageOpts pkg installMap installedMap locals addPkgs cabalFP
let filteredOpts = filterWanted opts
name = package.name
dir = parent cabalFP
targetFiles = mfileTargets >>= M.lookup name
(mods, files, allOpts) <-
getPackageOpts package installMap installedMap locals addPkgs cabalFP
let opts = M.toList $ filterWanted allOpts
filterWanted :: Map NamedComponent a -> Map NamedComponent a
filterWanted = M.filterWithKey (\k _ -> k `S.member` allWanted)
allWanted = wantedPackageComponents bopts target pkg
pure GhciPkgInfo
{ name
, opts = M.toList filteredOpts
, dir = parent cabalFP
, modules = unionModuleMaps $
allWanted = wantedPackageComponents bopts target package
modules = unionModuleMaps $
map
( \(comp, mp) -> M.map
(\fp -> M.singleton fp (S.singleton (pkg.name, comp)))
(\fp -> M.singleton fp (S.singleton (name, comp)))
mp
)
(M.toList (filterWanted mods))
, mainIs = M.map (mapMaybe dotCabalMainPath) files
, cFiles = mconcat
mainIs = M.map (mapMaybe dotCabalMainPath) files
cFiles = mconcat
(M.elems (filterWanted (M.map (mapMaybe dotCabalCFilePath) files)))
, targetFiles = mfileTargets >>= M.lookup name
, package = pkg
pure GhciPkgInfo
{ name
, opts
, dir
, modules
, mainIs
, cFiles
, targetFiles
, package
}

-- NOTE: this should make the same choices as the components code in
Expand Down