Skip to content

Commit 023fb60

Browse files
authored
Merge pull request #6445 from commercialhaskell/various-prefix
Remove prefixes from various type field names
2 parents ff3f11b + 8ad45ce commit 023fb60

21 files changed

+172
-164
lines changed

src/Stack/Build/Cache.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ getPrecompiledCacheKey loc copts buildHaddocks = do
361361
-- In Cabal versions 1.22 and later, the configure options contain the
362362
-- installed package IDs, which is what we need for a unique hash. See also
363363
-- issue: https://github.com/commercialhaskell/stack/issues/1103
364-
let input = copts.coNoDirs
364+
let input = copts.noDirs
365365
optionsHash = Mem.convert $ hashWith SHA256 $ encodeUtf8 $ tshow input
366366

367367
pure $ precompiledCacheKey

src/Stack/Build/ConstructPlan.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ processDep pkgId name value = do
849849
Couldn'tResolveItsDependencies version
850850
pure $ Left (name, (range, mLatestApplicable, bd))
851851
Right adr
852-
| isDepTypeLibrary value.dvType && not (adrHasLibrary adr) ->
852+
| isDepTypeLibrary value.depType && not (adrHasLibrary adr) ->
853853
pure $ Left (name, (range, Nothing, HasNoLibrary))
854854
Right adr -> do
855855
addParent
@@ -864,7 +864,7 @@ processDep pkgId name value = do
864864
)
865865
)
866866
where
867-
range = value.dvVersionRange
867+
range = value.versionRange
868868
version = pkgVersion pkgId
869869
-- Update the parents map, for later use in plan construction errors
870870
-- - see 'getShortestDepsPath'.
@@ -1173,7 +1173,7 @@ checkAndWarnForUnknownTools p = do
11731173
-- From Cabal 2.0, build-tools can specify a pre-built executable that should
11741174
-- already be on the PATH.
11751175
notOnPath toolName = MaybeT $ do
1176-
let settings = minimalEnvSettings { esIncludeLocals = True }
1176+
let settings = minimalEnvSettings { includeLocals = True }
11771177
config <- view configL
11781178
menv <- liftIO $ config.processContextSettings settings
11791179
eFound <- runRIO menv $ findExecutable $ T.unpack toolName

src/Stack/Build/Execute.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ executePlan
242242

243243
config <- view configL
244244
menv' <- liftIO $ config.processContextSettings EnvSettings
245-
{ esIncludeLocals = True
246-
, esIncludeGhcPackagePath = True
247-
, esStackExe = True
248-
, esLocaleUtf8 = False
249-
, esKeepGhcRts = False
245+
{ includeLocals = True
246+
, includeGhcPackagePath = True
247+
, stackExe = True
248+
, localeUtf8 = False
249+
, keepGhcRts = False
250250
}
251251
withProcessContext menv' $
252252
forM_ boptsCli.exec $ \(cmd, args) ->

src/Stack/Build/ExecuteEnv.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,11 @@ withSingleContext
675675
unless config.allowDifferentUser $
676676
checkOwnership (pkgDir </> config.workDir)
677677
let envSettings = EnvSettings
678-
{ esIncludeLocals = taskTypeLocation taskType == Local
679-
, esIncludeGhcPackagePath = False
680-
, esStackExe = False
681-
, esLocaleUtf8 = True
682-
, esKeepGhcRts = False
678+
{ includeLocals = taskTypeLocation taskType == Local
679+
, includeGhcPackagePath = False
680+
, stackExe = False
681+
, localeUtf8 = True
682+
, keepGhcRts = False
683683
}
684684
menv <- liftIO $ config.processContextSettings envSettings
685685
distRelativeDir' <- distRelativeDir
@@ -748,7 +748,7 @@ withSingleContext
748748
forM (Map.toList customSetupDeps) $ \(name, depValue) -> do
749749
let matches (PackageIdentifier name' version) =
750750
name == name'
751-
&& version `withinRange` depValue.dvVersionRange
751+
&& version `withinRange` depValue.versionRange
752752
case filter (matches . fst) (Map.toList allDeps) of
753753
x:xs -> do
754754
unless (null xs) $

src/Stack/Build/ExecutePackage.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ getConfigCache ee task installedMap enableTest enableBench = do
189189
opts = mkOpts missing'
190190
allDeps = Set.fromList $ Map.elems missing' ++ Map.elems task.present
191191
cache = ConfigCache
192-
{ opts = opts { coNoDirs = opts.coNoDirs ++ map T.unpack extra }
192+
{ opts = opts { noDirs = opts.noDirs ++ map T.unpack extra }
193193
, deps = allDeps
194194
, components =
195195
case task.taskType of
@@ -1044,11 +1044,11 @@ singleTest topts testsToRun ac ee task installedMap = do
10441044
writeFileUtf8Builder fp ghcEnv
10451045
menv <- liftIO $
10461046
setEnv fp =<< config.processContextSettings EnvSettings
1047-
{ esIncludeLocals = taskLocation task == Local
1048-
, esIncludeGhcPackagePath = True
1049-
, esStackExe = True
1050-
, esLocaleUtf8 = False
1051-
, esKeepGhcRts = False
1047+
{ includeLocals = taskLocation task == Local
1048+
, includeGhcPackagePath = True
1049+
, stackExe = True
1050+
, localeUtf8 = False
1051+
, keepGhcRts = False
10521052
}
10531053
let emptyResult = Map.singleton testName Nothing
10541054
withProcessContext menv $ if exists

src/Stack/DependencyGraph.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ createPrunedDependencyGraph dotOpts = withDotConfig dotOpts $ do
9191
view $ buildConfigL . to (Map.keysSet . (.smWanted.project))
9292
logDebug "Creating dependency graph"
9393
resultGraph <- createDependencyGraph dotOpts
94-
let pkgsToPrune = if dotOpts.dotIncludeBase
95-
then dotOpts.dotPrune
96-
else Set.insert "base" dotOpts.dotPrune
94+
let pkgsToPrune = if dotOpts.includeBase
95+
then dotOpts.prune
96+
else Set.insert "base" dotOpts.prune
9797
prunedGraph = pruneGraph localNames pkgsToPrune resultGraph
9898
logDebug "Returning pruned dependency graph"
9999
pure (localNames, prunedGraph)
@@ -105,7 +105,7 @@ withDotConfig ::
105105
-> RIO Runner a
106106
withDotConfig opts inner =
107107
local (over globalOptsL modifyGO) $
108-
if opts.dotGlobalHints
108+
if opts.globalHints
109109
then withConfig NoReexec $ withBuildConfig withGlobalHints
110110
else withConfig YesReexec withReal
111111
where
@@ -165,13 +165,13 @@ withDotConfig opts inner =
165165

166166
boptsCLI = defaultBuildOptsCLI
167167
{ targets = opts.dotTargets
168-
, flags = opts.dotFlags
168+
, flags = opts.flags
169169
}
170170
modifyGO =
171-
(if opts.dotTestTargets
171+
(if opts.testTargets
172172
then set (globalOptsBuildOptsMonoidL . buildOptsMonoidTestsL) (Just True)
173173
else id) .
174-
(if opts.dotBenchTargets
174+
(if opts.benchTargets
175175
then set (globalOptsBuildOptsMonoidL . buildOptsMonoidBenchmarksL) (Just True)
176176
else id)
177177

@@ -205,7 +205,7 @@ createDependencyGraph dotOpts = do
205205
| otherwise =
206206
fmap (setOfPackageDeps &&& makePayload loc)
207207
(loadPackage loc flags ghcOptions cabalConfigOpts)
208-
resolveDependencies dotOpts.dotDependencyDepth graph depLoader
208+
resolveDependencies dotOpts.dependencyDepth graph depLoader
209209
where
210210
makePayload loc pkg = DotPayload (Just pkg.version)
211211
(Just pkg.license)
@@ -225,7 +225,7 @@ projectPackageDependencies dotOpts locals =
225225
in (pkg.name, (deps pkg packageDepsSet, lpPayload pkg loc)))
226226
locals
227227
where
228-
deps pkg packageDepsSet = if dotOpts.dotIncludeExternal
228+
deps pkg packageDepsSet = if dotOpts.includeExternal
229229
then Set.delete pkg.name packageDepsSet
230230
else Set.intersection localNames packageDepsSet
231231
localNames = Set.fromList $ map (.package.name) locals

src/Stack/Docker.hs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,27 +97,27 @@ getCmdArgs ::
9797
-> RIO env (FilePath,[String],[(String,String)],[Mount])
9898
getCmdArgs docker imageInfo isRemoteDocker = do
9999
config <- view configL
100-
deUser <-
100+
user <-
101101
if fromMaybe (not isRemoteDocker) docker.setUser
102102
then liftIO $ do
103-
duUid <- User.getEffectiveUserID
104-
duGid <- User.getEffectiveGroupID
105-
duGroups <- nubOrd <$> User.getGroups
106-
duUmask <- Files.setFileCreationMask 0o022
103+
uid <- User.getEffectiveUserID
104+
gid <- User.getEffectiveGroupID
105+
groups <- nubOrd <$> User.getGroups
106+
umask <- Files.setFileCreationMask 0o022
107107
-- Only way to get old umask seems to be to change it, so set it back afterward
108-
_ <- Files.setFileCreationMask duUmask
108+
_ <- Files.setFileCreationMask umask
109109
pure $ Just DockerUser
110-
{ duUid
111-
, duGid
112-
, duGroups
113-
, duUmask
110+
{ uid
111+
, gid
112+
, groups
113+
, umask
114114
}
115115
else pure Nothing
116116
args <-
117117
fmap
118118
( [ "--" ++ reExecArgName ++ "=" ++ showStackVersion
119119
, "--" ++ dockerEntrypointArgName
120-
, show DockerEntrypoint {deUser}
120+
, show DockerEntrypoint { user }
121121
] ++
122122
)
123123
(liftIO getArgs)
@@ -498,7 +498,7 @@ entrypoint config@Config{} de = do
498498
estackUserEntry0 <- liftIO $ tryJust (guard . isDoesNotExistError) $
499499
User.getUserEntryForName stackUserName
500500
-- Switch UID/GID if needed, and update user's home directory
501-
case de.deUser of
501+
case de.user of
502502
Nothing -> pure ()
503503
Just (DockerUser 0 _ _ _) -> pure ()
504504
Just du -> withProcessContext envOverride $
@@ -530,13 +530,13 @@ entrypoint config@Config{} de = do
530530
-- directory
531531
readProcessNull "groupadd"
532532
[ "-o"
533-
, "--gid",show du.duGid
533+
, "--gid",show du.gid
534534
, stackUserName
535535
]
536536
readProcessNull "useradd"
537537
[ "-oN"
538-
, "--uid", show du.duUid
539-
, "--gid", show du.duGid
538+
, "--uid", show du.uid
539+
, "--gid", show du.gid
540540
, "--home", toFilePathNoTrailingSep homeDir
541541
, stackUserName
542542
]
@@ -545,27 +545,27 @@ entrypoint config@Config{} de = do
545545
-- and home directory
546546
readProcessNull "usermod"
547547
[ "-o"
548-
, "--uid", show du.duUid
548+
, "--uid", show du.uid
549549
, "--home", toFilePathNoTrailingSep homeDir
550550
, stackUserName
551551
]
552552
readProcessNull "groupmod"
553553
[ "-o"
554-
, "--gid", show du.duGid
554+
, "--gid", show du.gid
555555
, stackUserName
556556
]
557-
forM_ du.duGroups $ \gid ->
557+
forM_ du.groups $ \gid ->
558558
readProcessNull "groupadd"
559559
[ "-o"
560560
, "--gid", show gid
561561
, "group" ++ show gid
562562
]
563563
-- 'setuid' to the wanted UID and GID
564564
liftIO $ do
565-
User.setGroupID du.duGid
566-
handleSetGroups du.duGroups
567-
User.setUserID du.duUid
568-
_ <- Files.setFileCreationMask du.duUmask
565+
User.setGroupID du.gid
566+
handleSetGroups du.groups
567+
User.setUserID du.uid
568+
_ <- Files.setFileCreationMask du.umask
569569
pure ()
570570
stackUserName = "stack" :: String
571571

src/Stack/Dot.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ printGraph dotOpts locals graph = do
4242
liftIO $ Text.putStrLn "}"
4343
where
4444
filteredLocals =
45-
Set.filter (\local' -> local' `Set.notMember` dotOpts.dotPrune) locals
45+
Set.filter (\local' -> local' `Set.notMember` dotOpts.prune) locals
4646

4747
-- | Print the local nodes with a different style depending on options
4848
printLocalNodes ::
@@ -54,7 +54,7 @@ printLocalNodes dotOpts locals =
5454
liftIO $ Text.putStrLn (Text.intercalate "\n" lpNodes)
5555
where
5656
applyStyle :: Text -> Text
57-
applyStyle n = if dotOpts.dotIncludeExternal
57+
applyStyle n = if dotOpts.includeExternal
5858
then n <> " [style=dashed];"
5959
else n <> " [style=solid];"
6060
lpNodes :: [Text]

src/Stack/Hoogle.hs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,10 @@ hoogleCmd (args, setup, rebuild, startServer) =
277277
installHoogle
278278
| otherwise -> prettyThrowIO $ HoogleNotFound err
279279

280-
envSettings =
281-
EnvSettings
282-
{ esIncludeLocals = True
283-
, esIncludeGhcPackagePath = True
284-
, esStackExe = True
285-
, esLocaleUtf8 = False
286-
, esKeepGhcRts = False
287-
}
280+
envSettings = EnvSettings
281+
{ includeLocals = True
282+
, includeGhcPackagePath = True
283+
, stackExe = True
284+
, localeUtf8 = False
285+
, keepGhcRts = False
286+
}

src/Stack/Ls.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ printTree opts dotOpts depth remainingDepsCounts packages dependencyMap =
384384
in case Map.lookup name dependencyMap of
385385
Just (deps, payload) -> do
386386
printTreeNode opts dotOpts depth newDepsCounts deps payload name
387-
if Just depth == dotOpts.dotDependencyDepth
387+
if Just depth == dotOpts.dependencyDepth
388388
then pure ()
389389
else printTree opts dotOpts (depth + 1) newDepsCounts deps
390390
dependencyMap
@@ -401,7 +401,7 @@ printTreeNode ::
401401
-> PackageName
402402
-> IO ()
403403
printTreeNode opts dotOpts depth remainingDepsCounts deps payload name =
404-
let remainingDepth = fromMaybe 999 dotOpts.dotDependencyDepth - depth
404+
let remainingDepth = fromMaybe 999 dotOpts.dependencyDepth - depth
405405
hasDeps = not $ null deps
406406
in T.putStrLn $
407407
treeNodePrefix "" remainingDepsCounts hasDeps remainingDepth <> " " <>

0 commit comments

Comments
 (0)