Skip to content

Commit

Permalink
Add ghci --no-hide-packages option #1517
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed Dec 16, 2015
1 parent b6066eb commit 068874a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/Stack/Ghci.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ data GhciOpts = GhciOpts
, ghciAdditionalPackages :: ![String]
, ghciMainIs :: !(Maybe Text)
, ghciSkipIntermediate :: !Bool
, ghciHidePackages :: !Bool
, ghciBuildOpts :: !BuildOpts
} deriving Show

Expand Down Expand Up @@ -98,8 +99,11 @@ ghci GhciOpts{..} = do
mainFile <- figureOutMainFile bopts mainIsTargets targets pkgs
wc <- getWhichCompiler
let pkgopts = hidePkgOpt ++ genOpts ++ ghcOpts
hidePkgOpt = if null pkgs then [] else ["-hide-all-packages"]
genOpts = nubOrd (concatMap (concatMap (bioOneWordOpts . snd) . ghciPkgOpts) pkgs)
hidePkgOpt = if null pkgs || not ghciHidePackages then [] else ["-hide-all-packages"]
oneWordOpts bio
| ghciHidePackages = bioOneWordOpts bio ++ bioPackageFlags bio
| otherwise = bioOneWordOpts bio
genOpts = nubOrd (concatMap (concatMap (oneWordOpts . snd) . ghciPkgOpts) pkgs)
(omittedOpts, ghcOpts) = partition badForGhci $
concatMap (concatMap (bioOpts . snd) . ghciPkgOpts) pkgs ++
getUserOptions Nothing ++
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Ide.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ getPackageOptsAndTargetFiles pwd pkg = do
let ghcOptions bio =
bioOneWordOpts bio ++
bioOpts bio ++
bioPackageFlags bio ++
maybe [] (\cabalMacros -> ["-optP-include", "-optP" <> toFilePath cabalMacros]) (bioCabalMacros bio)
return
( ("--dist-dir=" <> toFilePathNoTrailingSep dist) :
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ ghciOptsParser = GhciOpts
\module to load, such as for an executable for \
\test suite or benchmark."))
<*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies")
<*> boolFlags True "hide-packages" "package hiding" idm
<*> buildOptsParser Build

-- | Parser for exec command
Expand Down
3 changes: 2 additions & 1 deletion src/Stack/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ generateBuildInfoOpts sourceMap installedMap mcabalMacros cabalDir distDir omitP
--
-- See https://github.com/commercialhaskell/stack/issues/1255
, bioOneWordOpts = nubOrd $ concat
[extOpts b, srcOpts, includeOpts, deps, extra b, extraDirs, fworks b, cObjectFiles]
[extOpts b, srcOpts, includeOpts, extra b, extraDirs, fworks b, cObjectFiles]
, bioPackageFlags = deps
, bioCabalMacros = mcabalMacros
}
where
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Types/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ instance Show GetPackageOpts where
data BuildInfoOpts = BuildInfoOpts
{ bioOpts :: [String]
, bioOneWordOpts :: [String]
, bioPackageFlags :: [String]
-- ^ These options can safely have 'nubOrd' applied to them, as
-- there are no multi-word options (see
-- https://github.com/commercialhaskell/stack/issues/1255)
Expand Down

0 comments on commit 068874a

Please sign in to comment.