@@ -916,32 +916,37 @@ makeGhciPkgInfo ::
916916 -> RIO env GhciPkgInfo
917917makeGhciPkgInfo installMap installedMap locals addPkgs mfileTargets pkgDesc = do
918918 bopts <- view buildOptsL
919- let pkg = pkgDesc. package
919+ let package = pkgDesc. package
920920 cabalFP = pkgDesc. cabalFP
921921 target = pkgDesc. target
922- name = pkg. name
923- (mods, files, opts) <-
924- getPackageOpts pkg installMap installedMap locals addPkgs cabalFP
925- let filteredOpts = filterWanted opts
922+ name = package. name
923+ dir = parent cabalFP
924+ targetFiles = mfileTargets >>= M. lookup name
925+ (mods, files, allOpts) <-
926+ getPackageOpts package installMap installedMap locals addPkgs cabalFP
927+ let opts = M. toList $ filterWanted allOpts
926928 filterWanted :: Map NamedComponent a -> Map NamedComponent a
927929 filterWanted = M. filterWithKey (\ k _ -> k `S.member` allWanted)
928- allWanted = wantedPackageComponents bopts target pkg
929- pure GhciPkgInfo
930- { name
931- , opts = M. toList filteredOpts
932- , dir = parent cabalFP
933- , modules = unionModuleMaps $
930+ allWanted = wantedPackageComponents bopts target package
931+ modules = unionModuleMaps $
934932 map
935933 ( \ (comp, mp) -> M. map
936- (\ fp -> M. singleton fp (S. singleton (pkg . name, comp)))
934+ (\ fp -> M. singleton fp (S. singleton (name, comp)))
937935 mp
938936 )
939937 (M. toList (filterWanted mods))
940- , mainIs = M. map (mapMaybe dotCabalMainPath) files
941- , cFiles = mconcat
938+ mainIs = M. map (mapMaybe dotCabalMainPath) files
939+ cFiles = mconcat
942940 (M. elems (filterWanted (M. map (mapMaybe dotCabalCFilePath) files)))
943- , targetFiles = mfileTargets >>= M. lookup name
944- , package = pkg
941+ pure GhciPkgInfo
942+ { name
943+ , opts
944+ , dir
945+ , modules
946+ , mainIs
947+ , cFiles
948+ , targetFiles
949+ , package
945950 }
946951
947952-- NOTE: this should make the same choices as the components code in
0 commit comments