Skip to content

Commit

Permalink
Merge pull request #4747 from commercialhaskell/3315-ghci-multi-options
Browse files Browse the repository at this point in the history
stack ghci --ghc-options multi args (fixes #3315)
  • Loading branch information
snoyberg committed Apr 16, 2019
2 parents fa88229 + 073ed3f commit 4571dda
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Expand Up @@ -275,6 +275,8 @@ Bug fixes:
- Docker: fix detection of expected subprocess failures. This fixes
downloading a compatible `stack` executable when the host `stack` is not compatible with the Docker image (on Linux), and doesn't show an unnecessary
extra error when the in-container re-exec'ed `stack` exits with failure.
* The `stack ghci` command's `--ghc-options` flag now parses multiple options.
See [#3315](https://github.com/commercialhaskell/stack/issues/3315).

## v1.9.3

Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Ghci.hs
Expand Up @@ -54,7 +54,7 @@ import System.Permissions (setScriptPerms)
data GhciOpts = GhciOpts
{ ghciTargets :: ![Text]
, ghciArgs :: ![String]
, ghciGhcOptions :: ![Text]
, ghciGhcOptions :: ![String]
, ghciFlags :: !(Map ApplyCLIFlag (Map FlagName Bool))
, ghciGhcCommand :: !(Maybe FilePath)
, ghciNoLoadModules :: !Bool
Expand Down Expand Up @@ -413,7 +413,7 @@ runGhci GhciOpts{..} targets mainFile pkgs extraFiles exposePackages = do
-- not include CWD. If there aren't any packages, CWD
-- is included.
(if null pkgs then id else ("-i" : )) $
odir <> pkgopts <> extras <> map T.unpack ghciGhcOptions <> ghciArgs)
odir <> pkgopts <> extras <> ghciGhcOptions <> ghciArgs)
-- TODO: Consider optimizing this check. Perhaps if no
-- "with-ghc" is specified, assume that it is not using intero.
checkIsIntero =
Expand Down
6 changes: 3 additions & 3 deletions src/Stack/Options/GhciParser.hs
Expand Up @@ -34,12 +34,12 @@ ghciOptsParser = GhciOpts
completer ghcOptsCompleter <>
help "Additional options passed to GHCi"))
)
<*> many
(textOption
<*> (concat <$> many
(argsOption
(long "ghc-options" <>
metavar "OPTIONS" <>
completer ghcOptsCompleter <>
help "Additional options passed to both GHC and GHCi"))
help "Additional options passed to both GHC and GHCi")))
<*> flagsParser
<*> optional
(strOption (long "with-ghc" <>
Expand Down
2 changes: 1 addition & 1 deletion src/main/Main.hs
Expand Up @@ -866,7 +866,7 @@ ghciCmd ghciOpts =
{ boptsCLITargets = map T.pack (ghciAdditionalPackages ghciOpts)
, boptsCLIInitialBuildSteps = True
, boptsCLIFlags = ghciFlags ghciOpts
, boptsCLIGhcOptions = ghciGhcOptions ghciOpts
, boptsCLIGhcOptions = map T.pack (ghciGhcOptions ghciOpts)
}
in withConfig YesReexec $ withEnvConfig AllowNoTargets boptsCLI $ do
bopts <- view buildOptsL
Expand Down
7 changes: 2 additions & 5 deletions test/integration/tests/3315-multi-ghc-options/Main.hs
Expand Up @@ -2,8 +2,5 @@ import StackTest

main :: IO ()
main = do
return ()
{- FIXME: Temporarily disabled. See #3353 / #3315
stack ["build", "--ghc-options=-DBAR -DBAZ"]
stack ["setup", "--ghcjs-boot-options=-DBAR -DBAZ"]
-}
stack ["build", "--ghc-options=-ddump-simpl -ddump-asm -DBAR -DBAZ"]
repl ["--ghc-options=-ddump-simpl -ddump-asm"] (pure ())

0 comments on commit 4571dda

Please sign in to comment.