Skip to content

Commit

Permalink
--skip-ghc-check #423
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jun 26, 2015
1 parent 80b9df2 commit 7e1b0fb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Add the `stack dot` command
* `stack upgrade` added [#237](https://github.com/commercialhaskell/stack/issues/237)
* `--stack-yaml` command line flag [#378](https://github.com/commercialhaskell/stack/issues/378)
* `--skip-ghc-check` command line flag [#423](https://github.com/commercialhaskell/stack/issues/423)

Bug fixes:

Expand Down
8 changes: 7 additions & 1 deletion src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ configFromConfigMonoid configStackRoot mproject configMonoid@ConfigMonoid{..} =

configSystemGHC = fromMaybe True configMonoidSystemGHC
configInstallGHC = fromMaybe False configMonoidInstallGHC
configSkipGHCCheck = fromMaybe False configMonoidSkipGHCCheck

configExtraIncludeDirs = configMonoidExtraIncludeDirs
configExtraLibDirs = configMonoidExtraLibDirs
Expand Down Expand Up @@ -158,10 +159,11 @@ configFromConfigMonoid configStackRoot mproject configMonoid@ConfigMonoid{..} =
-- | Command-line arguments parser for configuration.
configOptsParser :: Bool -> Parser ConfigMonoid
configOptsParser docker =
(\opts systemGHC installGHC arch os jobs includes libs -> mempty
(\opts systemGHC installGHC arch os jobs includes libs skipGHCCheck -> mempty
{ configMonoidDockerOpts = opts
, configMonoidSystemGHC = systemGHC
, configMonoidInstallGHC = installGHC
, configMonoidSkipGHCCheck = skipGHCCheck
, configMonoidArch = arch
, configMonoidOS = os
, configMonoidJobs = jobs
Expand Down Expand Up @@ -203,6 +205,10 @@ configOptsParser docker =
<> metavar "DIR"
<> help "Extra directories to check for libraries"
))
<*> maybeBoolFlags
"skip-ghc-check"
"skipping the GHC version and architecture check"
idm

-- | Get the directory on Windows where we should install extra programs. For
-- more information, see discussion at:
Expand Down
4 changes: 4 additions & 0 deletions src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ data SetupOpts = SetupOpts
, soptsForceReinstall :: !Bool
, soptsSanityCheck :: !Bool
-- ^ Run a sanity check on the selected GHC
, soptsSkipGhcCheck :: !Bool
-- ^ Don't check for a compatible GHC version/architecture
}
deriving Show
data SetupException = UnsupportedSetupCombo OS Arch
Expand Down Expand Up @@ -122,6 +124,7 @@ setupEnv = do
, soptsStackYaml = Just $ bcStackYaml bconfig
, soptsForceReinstall = False
, soptsSanityCheck = False
, soptsSkipGhcCheck = configSkipGHCCheck $ bcConfig bconfig
}
mghcBin <- ensureGHC sopts
menv0 <- getMinimalEnvOverride
Expand Down Expand Up @@ -245,6 +248,7 @@ ensureGHC sopts = do

let needLocal = case msystem of
Nothing -> True
Just _ | soptsSkipGhcCheck sopts -> False
Just (system, arch) ->
-- we allow a newer version of GHC within the same major series
getMajorVersion system /= getMajorVersion expected ||
Expand Down
10 changes: 9 additions & 1 deletion src/Stack/Types/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ data Config =
,configInstallGHC :: !Bool
-- ^ Should we automatically install GHC if missing or the wrong
-- version is available? Can be overridden by command line options.
,configSkipGHCCheck :: !Bool
-- ^ Don't bother checking the GHC version or architecture.
,configLocalBin :: !(Path Abs Dir)
-- ^ Directory we should install executables into
,configRequireStackVersion :: !VersionRange
Expand Down Expand Up @@ -412,6 +414,8 @@ data ConfigMonoid =
-- ^ See: 'configSystemGHC'
,configMonoidInstallGHC :: !(Maybe Bool)
-- ^ See: 'configInstallGHC'
,configMonoidSkipGHCCheck :: !(Maybe Bool)
-- ^ See: 'configSkipGHCCheck'
,configMonoidRequireStackVersion :: !VersionRange
-- ^ See: 'configRequireStackVersion'
,configMonoidOS :: !(Maybe String)
Expand All @@ -436,6 +440,7 @@ instance Monoid ConfigMonoid where
, configMonoidPackageIndices = Nothing
, configMonoidSystemGHC = Nothing
, configMonoidInstallGHC = Nothing
, configMonoidSkipGHCCheck = Nothing
, configMonoidRequireStackVersion = anyVersion
, configMonoidOS = Nothing
, configMonoidArch = Nothing
Expand All @@ -449,7 +454,9 @@ instance Monoid ConfigMonoid where
, configMonoidHideTHLoading = configMonoidHideTHLoading l <|> configMonoidHideTHLoading r
, configMonoidLatestSnapshotUrl = configMonoidLatestSnapshotUrl l <|> configMonoidLatestSnapshotUrl r
, configMonoidPackageIndices = configMonoidPackageIndices l <|> configMonoidPackageIndices r
, configMonoidSystemGHC = configMonoidSystemGHC l <|> configMonoidSystemGHC r , configMonoidInstallGHC = configMonoidInstallGHC l <|> configMonoidInstallGHC r
, configMonoidSystemGHC = configMonoidSystemGHC l <|> configMonoidSystemGHC r
, configMonoidInstallGHC = configMonoidInstallGHC l <|> configMonoidInstallGHC r
, configMonoidSkipGHCCheck = configMonoidSkipGHCCheck l <|> configMonoidSkipGHCCheck r
, configMonoidRequireStackVersion = intersectVersionRanges (configMonoidRequireStackVersion l)
(configMonoidRequireStackVersion r)
, configMonoidOS = configMonoidOS l <|> configMonoidOS r
Expand All @@ -470,6 +477,7 @@ instance FromJSON ConfigMonoid where
configMonoidPackageIndices <- obj .:? "package-indices"
configMonoidSystemGHC <- obj .:? "system-ghc"
configMonoidInstallGHC <- obj .:? "install-ghc"
configMonoidSkipGHCCheck <- obj .:? "skip-ghc-check"
configMonoidRequireStackVersion <- unVersionRangeJSON <$>
obj .:? "require-stack-version"
.!= VersionRangeJSON anyVersion
Expand Down
1 change: 1 addition & 0 deletions src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ setupCmd SetupCmdOpts{..} go@GlobalOpts{..} = do
, soptsStackYaml = mstack
, soptsForceReinstall = scoForceReinstall
, soptsSanityCheck = True
, soptsSkipGhcCheck = False
}
case mpaths of
Nothing -> $logInfo "GHC on PATH would be used"
Expand Down

0 comments on commit 7e1b0fb

Please # to comment.