Skip to content

Commit 4ad539e

Browse files
authored
Merge pull request #6456 from commercialhaskell/rename
2 parents 294b7d4 + cc4862d commit 4ad539e

File tree

7 files changed

+42
-37
lines changed

7 files changed

+42
-37
lines changed

src/Stack/Build/ConstructPlan.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ constructPlan
155155
econfig <- view envConfigL
156156
globalCabalVersion <- view $ compilerPathsL . to (.cabalVersion)
157157
sources <- getSources globalCabalVersion
158-
mcur <- view $ buildConfigL . to (.curator)
159-
pathEnvVar' <- liftIO $ maybe mempty T.pack <$> lookupEnv "PATH"
160-
let ctx = mkCtx econfig globalCabalVersion sources mcur pathEnvVar'
158+
curator <- view $ buildConfigL . to (.curator)
159+
pathEnvVar <- liftIO $ maybe mempty T.pack <$> lookupEnv "PATH"
160+
let ctx = mkCtx econfig globalCabalVersion sources curator pathEnvVar
161161
targetPackageNames = Map.keys sourceMap.targets.targets
162162
-- Ignore the result of 'getCachedDepOrAddDep'.
163163
onTarget = void . getCachedDepOrAddDep
@@ -204,17 +204,17 @@ constructPlan
204204

205205
hasBaseInDeps = Map.member (mkPackageName "base") sourceDeps
206206

207-
mkCtx econfig globalCabalVersion sources mcur pathEnvVar' = Ctx
207+
mkCtx ctxEnvConfig globalCabalVersion sources curator pathEnvVar = Ctx
208208
{ baseConfigOpts = baseConfigOpts0
209-
, loadPackage = \w x y z -> runRIO econfig $
209+
, loadPackage = \w x y z -> runRIO ctxEnvConfig $
210210
applyForceCustomBuild globalCabalVersion <$> loadPackage0 w x y z
211211
, combinedMap = combineMap sources installedMap
212-
, ctxEnvConfig = econfig
212+
, ctxEnvConfig
213213
, callStack = []
214214
, wanted = Map.keysSet sourceMap.targets.targets
215215
, localNames = Map.keysSet sourceProject
216-
, mcurator = mcur
217-
, pathEnvVar = pathEnvVar'
216+
, curator
217+
, pathEnvVar
218218
}
219219

220220
toEither :: (k, Either e v) -> Either e (k, v)
@@ -662,7 +662,7 @@ installPackage name ps minstalled = do
662662
-- test/benchmark failure could prevent library from being
663663
-- available to its dependencies but when it's already available
664664
-- it's OK to do that
665-
splitRequired <- expectedTestOrBenchFailures <$> asks (.mcurator)
665+
splitRequired <- expectedTestOrBenchFailures <$> asks (.curator)
666666
let isAllInOne = not splitRequired
667667
adr <- installPackageGivenDeps
668668
isAllInOne lp.buildHaddocks ps tb minstalled deps

src/Stack/Build/ExecutePackage.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ singleBuild
369369
case mprecompiled of
370370
Just precompiled -> copyPreCompiled ee task pkgId precompiled
371371
Nothing -> do
372-
mcurator <- view $ buildConfigL . to (.curator)
373-
realConfigAndBuild cache mcurator allDepsMap
372+
curator <- view $ buildConfigL . to (.curator)
373+
realConfigAndBuild cache curator allDepsMap
374374
case minstalled of
375375
Nothing -> pure ()
376376
Just installed -> do
@@ -380,15 +380,15 @@ singleBuild
380380
where
381381
pkgId = taskProvides task
382382
PackageIdentifier pname _ = pkgId
383-
doHaddock mcurator package =
383+
doHaddock curator package =
384384
task.buildHaddock
385385
&& not isFinalBuild
386386
-- Works around haddock failing on bytestring-builder since it has no
387387
-- modules when bytestring is new enough.
388388
&& mainLibraryHasExposedModules package
389389
-- Special help for the curator tool to avoid haddocks that are known
390390
-- to fail
391-
&& maybe True (Set.notMember pname . (.skipHaddock)) mcurator
391+
&& maybe True (Set.notMember pname . (.skipHaddock)) curator
392392

393393
buildingFinals = isFinalBuild || task.allInOne
394394
enableTests = buildingFinals && any isCTest (taskComponents task)

src/Stack/Config.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ withBuildConfig inner = do
833833
pure Project
834834
{ userMsg = Nothing
835835
, packages = []
836-
, dependencies = map (RPLImmutable . flip RPLIHackage Nothing) extraDeps
836+
, extraDeps = map (RPLImmutable . flip RPLIHackage Nothing) extraDeps
837837
, flagsByPkg = mempty
838838
, resolver = r
839839
, compiler = Nothing
@@ -867,11 +867,11 @@ fillProjectWanted stackYamlFP config project locCache snapCompiler snapPackages
867867
(RPLImmutable (RPLIRepo repo rpm)) -> Just (repo, rpm)
868868
_ -> Nothing
869869
)
870-
project.dependencies
870+
project.extraDeps
871871
logDebug ("Prefetching git repos: " <> display (T.pack (show gitRepos)))
872872
fetchReposRaw gitRepos
873873

874-
(deps0, mcompleted) <- fmap unzip . forM project.dependencies $ \rpl -> do
874+
(deps0, mcompleted) <- fmap unzip . forM project.extraDeps $ \rpl -> do
875875
(pl, mCompleted) <- case rpl of
876876
RPLImmutable rpli -> do
877877
(compl, mcompl) <-

src/Stack/Init.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ initProject currDir initOpts mresolver = do
281281
PLImmutable . cplComplete <$>
282282
completePackageLocation
283283
(RPLIHackage (PackageIdentifierRevision n v CFILatest) Nothing)
284-
let p = Project
284+
let project = Project
285285
{ userMsg = if userMsg == "" then Nothing else Just userMsg
286286
, packages = resolvedRelative <$> Map.elems rbundle
287-
, dependencies = map toRawPL deps
287+
, extraDeps = map toRawPL deps
288288
, flagsByPkg = removeSrcPkgDefaultFlags gpds flags
289289
, resolver = snapshotLoc
290290
, compiler = Nothing
@@ -336,7 +336,7 @@ initProject currDir initOpts mresolver = do
336336
else "Writing configuration to"
337337
, style File (fromString reldest) <> "."
338338
]
339-
writeBinaryFileAtomic dest $ renderStackYaml p
339+
writeBinaryFileAtomic dest $ renderStackYaml project
340340
(Map.elems $ fmap (makeRelDir . parent . fst) ignored)
341341
(map (makeRelDir . parent) dupPkgs)
342342
prettyInfoS

src/Stack/Types/Build/ConstructPlan.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ data Ctx = Ctx
161161
, callStack :: ![PackageName]
162162
, wanted :: !(Set PackageName)
163163
, localNames :: !(Set PackageName)
164-
, mcurator :: !(Maybe Curator)
164+
, curator :: !(Maybe Curator)
165165
, pathEnvVar :: !Text
166166
}
167167

src/Stack/Types/Project.hs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE NoFieldSelectors #-}
3-
{-# LANGUAGE OverloadedStrings #-}
1+
{-# LANGUAGE NoImplicitPrelude #-}
2+
{-# LANGUAGE NoFieldSelectors #-}
3+
{-# LANGUAGE OverloadedRecordDot #-}
4+
{-# LANGUAGE OverloadedStrings #-}
45

56
module Stack.Types.Project
67
( Project (..)
@@ -21,7 +22,7 @@ data Project = Project
2122
, packages :: ![RelFilePath]
2223
-- ^ Packages which are actually part of the project (as opposed
2324
-- to dependencies).
24-
, dependencies :: ![RawPackageLocation]
25+
, extraDeps :: ![RawPackageLocation]
2526
-- ^ Dependencies defined within the stack.yaml file, to be applied on top
2627
-- of the snapshot.
2728
, flagsByPkg :: !(Map PackageName (Map FlagName Bool))
@@ -42,16 +43,20 @@ data Project = Project
4243

4344
instance ToJSON Project where
4445
-- Expanding the constructor fully to ensure we don't miss any fields.
45-
toJSON (Project userMsg packages extraDeps flags resolver mcompiler extraPackageDBs mcurator drops) = object $ concat
46-
[ maybe [] (\cv -> ["compiler" .= cv]) mcompiler
47-
, maybe [] (\msg -> ["user-message" .= msg]) userMsg
48-
, [ "extra-package-dbs" .= extraPackageDBs | not (null extraPackageDBs) ]
49-
, [ "extra-deps" .= extraDeps | not (null extraDeps) ]
50-
, [ "flags" .= fmap toCabalStringMap (toCabalStringMap flags)
51-
| not (Map.null flags)
46+
toJSON project = object $ concat
47+
[ maybe [] (\cv -> ["compiler" .= cv]) project.compiler
48+
, maybe [] (\msg -> ["user-message" .= msg]) project.userMsg
49+
, [ "extra-package-dbs" .= project.extraPackageDBs
50+
| not (null project.extraPackageDBs)
51+
]
52+
, [ "extra-deps" .= project.extraDeps | not (null project.extraDeps) ]
53+
, [ "flags" .= fmap toCabalStringMap (toCabalStringMap project.flagsByPkg)
54+
| not (Map.null project.flagsByPkg)
55+
]
56+
, ["packages" .= project.packages]
57+
, ["resolver" .= project.resolver]
58+
, maybe [] (\c -> ["curator" .= c]) project.curator
59+
, [ "drop-packages" .= Set.map CabalString project.dropPackages
60+
| not (Set.null project.dropPackages)
5261
]
53-
, ["packages" .= packages]
54-
, ["resolver" .= resolver]
55-
, maybe [] (\c -> ["curator" .= c]) mcurator
56-
, [ "drop-packages" .= Set.map CabalString drops | not (Set.null drops) ]
5762
]

src/Stack/Types/ProjectAndConfigMonoid.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ parseProjectAndConfigMonoid rootDir =
4343
let dropPackages = Set.map unCabalString drops
4444
pure $ do
4545
deps' <- mapM (resolvePaths (Just rootDir)) deps
46-
let dependencies =
46+
let extraDeps =
4747
concatMap toList (deps' :: [NonEmpty RawPackageLocation])
4848
resolver <- resolvePaths (Just rootDir) resolver'
4949
let project = Project
@@ -52,7 +52,7 @@ parseProjectAndConfigMonoid rootDir =
5252
, compiler -- FIXME make sure resolver' isn't SLCompiler
5353
, extraPackageDBs
5454
, packages
55-
, dependencies
55+
, extraDeps
5656
, flagsByPkg
5757
, curator
5858
, dropPackages

0 commit comments

Comments
 (0)