Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use exact GHC versions rather than major-version #736 #784

Merged
merged 3 commits into from
Aug 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 0.1.3.1

Major changes:

* You now have more control over how GHC versions are matched, e.g. "use exactly this version," "use the specified minor version, but allow patches," or "use the given minor version or any later minor in the given major release." The default has switched from allowing newer later minor versions to a specific minor version allowing patches. For more information, see [#736](https://github.com/commercialhaskell/stack/issues/736) and [#784](https://github.com/commercialhaskell/stack/pull/784).

Bug fixes:

* Ignore disabled executables [#763](https://github.com/commercialhaskell/stack/issues/763)
Expand Down
11 changes: 7 additions & 4 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ parseTargetsFromBuildOpts needTargets bopts = do
ResolverSnapshot snapName -> do
$logDebug $ "Checking resolver: " <> renderSnapName snapName
loadMiniBuildPlan snapName
ResolverGhc ghc ->
return
MiniBuildPlan
{ mbpGhcVersion = fromMajorVersion ghc
ResolverCompiler _ -> do
-- We ignore the resolver version, as it might be
-- GhcMajorVersion, and we want the exact version
-- we're using.
version <- asks (envConfigGhcVersion . getEnvConfig)
return MiniBuildPlan
{ mbpGhcVersion = version
, mbpPackages = Map.empty
}
ResolverCustom _ url -> do
Expand Down
5 changes: 3 additions & 2 deletions src/Stack/BuildPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,8 @@ data CustomSnapshot = CustomSnapshot
instance FromJSON CustomSnapshot where
parseJSON = withObject "CustomSnapshot" $ \o -> CustomSnapshot
<$> ((o .: "compiler") >>= (\t -> maybe (fail $ "Invalid compiler: " ++ T.unpack t) return $ do
t' <- T.stripPrefix "ghc-" t
parseVersionFromString $ T.unpack t'))
cv <- parseCompilerVersion t
case cv of
GhcVersion v -> return v))
<*> o .: "packages"
<*> o .:? "flags" .!= Map.empty
12 changes: 7 additions & 5 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ configFromConfigMonoid configStackRoot mproject configMonoid@ConfigMonoid{..} =

configImage = Image.imgOptsFromMonoid configMonoidImageOpts

configCompilerCheck = fromMaybe MatchMinor configMonoidCompilerCheck

origEnv <- getEnvOverride configPlatform
let configEnvOverride _ = return origEnv

Expand Down Expand Up @@ -281,20 +283,20 @@ loadBuildConfig mproject config stackRoot mresolver = do
(MiniConfig manager config)
let project = project' { projectResolver = resolver }

ghcVersion <-
wantedCompiler <-
case projectResolver project of
ResolverSnapshot snapName -> do
mbp <- runReaderT (loadMiniBuildPlan snapName) miniConfig
return $ mbpGhcVersion mbp
ResolverGhc m -> return $ fromMajorVersion m
return $ GhcVersion $ mbpGhcVersion mbp
ResolverCustom _name url -> do
mbp <- runReaderT (parseCustomMiniBuildPlan stackYamlFP url) miniConfig
return $ mbpGhcVersion mbp
return $ GhcVersion $ mbpGhcVersion mbp
ResolverCompiler wantedCompiler -> return wantedCompiler

return BuildConfig
{ bcConfig = config
, bcResolver = projectResolver project
, bcGhcVersionExpected = ghcVersion
, bcWantedCompiler = wantedCompiler
, bcPackageEntries = projectPackages project
, bcExtraDeps = projectExtraDeps project
, bcStackYaml = stackYamlFP
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Fetch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,14 @@ fuzzyLookupCandidates (PackageIdentifier name ver) caches =
if null sameMajor then Nothing else Just (map fst sameMajor)
where
sameMajor = filter (\(PackageIdentifier _ v, _) ->
getMajorVersion ver == getMajorVersion v)
toMajorVersion ver == toMajorVersion v)
sameIdentCaches
sameIdentCaches = maybe biggerFiltered
(\z -> (zeroIdent, z) : biggerFiltered)
zeroVer
biggerFiltered = takeWhile (\(PackageIdentifier n _, _) -> name == n)
(Map.toList bigger)
zeroIdent = PackageIdentifier name (fromMajorVersion (MajorVersion 0 0))
zeroIdent = PackageIdentifier name $(mkVersion "0.0")
(_, zeroVer, bigger) = Map.splitLookup zeroIdent caches

-- | Figure out where to fetch from.
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ getDefaultResolver cabalfps gpds initOpts =
mpair <-
case resolver of
ResolverSnapshot name -> findBuildPlan gpds [name]
ResolverGhc _ -> return Nothing
ResolverCompiler _ -> return Nothing
ResolverCustom _ _ -> return Nothing
case mpair of
Just (snap, flags) ->
Expand All @@ -157,7 +157,7 @@ getDefaultResolver cabalfps gpds initOpts =
MethodSolver -> do
(ghcVersion, extraDeps) <- cabalSolver (map parent cabalfps) Map.empty []
return
( ResolverGhc ghcVersion
( ResolverCompiler (GhcVersion ghcVersion)
, Map.filter (not . Map.null) $ fmap snd extraDeps
, fmap fst extraDeps
)
Expand Down
Loading