Skip to content

Commit

Permalink
Address option compatibility issues around system-ghc
Browse files Browse the repository at this point in the history
* Add notes to ghc-variant and setup --reinstall help texts
* Add a check to catch uses of ghc-variant in combination with
  no-system-ghc
  • Loading branch information
sjakobi committed Aug 29, 2016
1 parent bc8b3af commit 4815267
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/yaml_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ Specify a variant binary distribution of GHC to use. Known values:
[setup-info](#setup-info) so `stack setup` knows where to download it, or
pass the `stack setup --ghc-bindist` argument on the command-line

This option is incompatible with `system-ghc: true`.

### setup-info

(Since 0.1.5)
Expand Down
7 changes: 5 additions & 2 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,12 @@ configFromConfigMonoid configStackRoot configUserConfigPath mresolver mproject C
configMonoidPackageIndices

configGHCVariant0 = getFirst configMonoidGHCVariant

configSystemGHC = fromFirst False configMonoidSystemGHC
configInstallGHC = fromFirst False configMonoidInstallGHC

when (isJust configGHCVariant0 && configSystemGHC) $
throwM ManualGHCVariantSettingsAreIncompatibleWithSystemGHC

let configInstallGHC = fromFirst False configMonoidInstallGHC
configSkipGHCCheck = fromFirst False configMonoidSkipGHCCheck
configSkipMsys = fromFirst False configMonoidSkipMsys

Expand Down
2 changes: 1 addition & 1 deletion src/Stack/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ ghcVariantParser hide =
readGHCVariant
(long "ghc-variant" <> metavar "VARIANT" <>
help
"Specialized GHC variant, e.g. integersimple" <>
"Specialized GHC variant, e.g. integersimple (incompatible with --system-ghc)" <>
hideMods hide
)
where
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/SetupCmd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ setupParser = SetupCmdOpts
"The default is to install the version implied by the resolver.")))
<*> OA.boolFlags False
"reinstall"
"reinstalling GHC, even if available"
"reinstalling GHC, even if available (incompatible with --system-ghc)"
OA.idm
<*> OA.boolFlags False
"upgrade-cabal"
Expand Down
8 changes: 8 additions & 0 deletions src/Stack/Types/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ data ConfigException
| BadStackRoot (Path Abs Dir)
| Won'tCreateStackRootInDirectoryOwnedByDifferentUser (Path Abs Dir) (Path Abs Dir) -- ^ @$STACK_ROOT@, parent dir
| UserDoesn'tOwnDirectory (Path Abs Dir)
| ManualGHCVariantSettingsAreIncompatibleWithSystemGHC
deriving Typeable
instance Show ConfigException where
show (ParseConfigFileException configFile exception) = concat
Expand Down Expand Up @@ -1138,6 +1139,13 @@ instance Show ConfigException where
, T.unpack configMonoidAllowDifferentUserName
, "' to disable this precaution."
]
show ManualGHCVariantSettingsAreIncompatibleWithSystemGHC = T.unpack $ T.concat
[ "stack can only control the "
, configMonoidGHCVariantName
, " of its own GHC installations. Please use '--no-"
, configMonoidSystemGHCName
, "'."
]
instance Exception ConfigException

showOptions :: WhichSolverCmd -> String
Expand Down

0 comments on commit 4815267

Please sign in to comment.