Skip to content

Commit 05e3e6c

Browse files
authored
Merge pull request #6443 from commercialhaskell/cp-prefix
2 parents 09ccf29 + 1404922 commit 05e3e6c

File tree

15 files changed

+94
-92
lines changed

15 files changed

+94
-92
lines changed

src/Stack/Build/ConstructPlan.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ constructPlan
153153
<> line
154154

155155
econfig <- view envConfigL
156-
globalCabalVersion <- view $ compilerPathsL . to (.cpCabalVersion)
156+
globalCabalVersion <- view $ compilerPathsL . to (.cabalVersion)
157157
sources <- getSources globalCabalVersion
158158
mcur <- view $ buildConfigL . to (.curator)
159159
pathEnvVar' <- liftIO $ maybe mempty T.pack <$> lookupEnv "PATH"

src/Stack/Build/ExecuteEnv.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ withExecuteEnv bopts boptsCli baseConfigOpts locals globalPackages snapshotPacka
306306
setupExe <- getSetupExe setupHs setupShimHs tmpdir
307307

308308
cabalPkgVer <- view cabalVersionL
309-
globalDB <- view $ compilerPathsL . to (.cpGlobalDB)
309+
globalDB <- view $ compilerPathsL . to (.globalDB)
310310
snapshotPackagesTVar <-
311311
liftIO $ newTVarIO (toDumpPackagesByGhcPkgId snapshotPackages)
312312
localPackagesTVar <-
@@ -879,7 +879,7 @@ withSingleContext
879879
then pure outputFile
880880
else do
881881
ensureDir setupDir
882-
compilerPath <- view $ compilerPathsL . to (.cpCompiler)
882+
compilerPath <- view $ compilerPathsL . to (.compiler)
883883
packageArgs <- getPackageArgs setupDir
884884
runExe compilerPath $
885885
[ "--make"

src/Stack/Build/ExecutePackage.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,11 @@ ensureConfig newConfigCache pkgDir buildOpts announce cabal cabalfp task = do
276276
deleteCaches pkgDir
277277
announce
278278
cp <- view compilerPathsL
279-
let (GhcPkgExe pkgPath) = cp.cpPkg
279+
let (GhcPkgExe pkgPath) = cp.pkg
280280
let programNames =
281281
case cpWhich cp of
282282
Ghc ->
283-
[ ("ghc", toFilePath cp.cpCompiler)
283+
[ ("ghc", toFilePath cp.compiler)
284284
, ("ghc-pkg", toFilePath pkgPath)
285285
]
286286
exes <- forM programNames $ \(name, file) -> do

src/Stack/Build/Haddock.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ generateHaddockIndex descr bco dumpPackages docRelFP destDir = do
236236
<> line
237237
<> pretty destIndexFile
238238
liftIO (mapM_ copyPkgDocs interfaceOpts)
239-
haddockExeName <- view $ compilerPathsL . to (toFilePath . (.cpHaddock))
239+
haddockExeName <- view $ compilerPathsL . to (toFilePath . (.haddock))
240240
withWorkingDir (toFilePath destDir) $ readProcessNull
241241
haddockExeName
242242
( map

src/Stack/Exec.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ execCmd opts =
160160

161161
getGhcCmd pkgs args = do
162162
pkgopts <- getPkgOpts pkgs
163-
compiler <- view $ compilerPathsL . to (.cpCompiler)
163+
compiler <- view $ compilerPathsL . to (.compiler)
164164
pure (toFilePath compiler, pkgopts ++ args)
165165

166166
getRunGhcCmd pkgs args = do
167167
pkgopts <- getPkgOpts pkgs
168-
interpret <- view $ compilerPathsL . to (.cpInterpreter)
168+
interpret <- view $ compilerPathsL . to (.interpreter)
169169
pure (toFilePath interpret, pkgopts ++ args)
170170

171171
runWithPath :: Maybe FilePath -> RIO EnvConfig () -> RIO EnvConfig ()

src/Stack/GhcPkg.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ unregisterGhcPkgIds ::
169169
-> NonEmpty (Either PackageIdentifier GhcPkgId)
170170
-> RIO env ()
171171
unregisterGhcPkgIds isWarn pkgexe pkgDb epgids = do
172-
globalDb <- view $ compilerPathsL . to (.cpGlobalDB)
172+
globalDb <- view $ compilerPathsL . to (.globalDB)
173173
eres <- try $ do
174174
ghcPkgUnregisterForce globalDb pkgDb hasIpid pkgarg_strs
175175
-- ghcPkgUnregisterForce does not perform an effective

src/Stack/Ghci.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ runGhci
573573
(map (fromPackageName . (.ghciPkgName)) pkgs :: [StyleDoc])
574574
)
575575
compilerExeName <-
576-
view $ compilerPathsL . to (.cpCompiler) . to toFilePath
576+
view $ compilerPathsL . to (.compiler) . to toFilePath
577577
let execGhci extras = do
578578
menv <-
579579
liftIO $ config.processContextSettings defaultEnvSettings

src/Stack/Path.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fillPathInfo = do
104104
piSnapDb <- packageDatabaseDeps
105105
piLocalDb <- packageDatabaseLocal
106106
piExtraDbs <- packageDatabaseExtra
107-
piGlobalDb <- view $ compilerPathsL . to (.cpGlobalDB)
107+
piGlobalDb <- view $ compilerPathsL . to (.globalDB)
108108
piSnapRoot <- installationRootDeps
109109
piLocalRoot <- installationRootLocal
110110
piToolsDir <- bindirCompilerTools

src/Stack/Script.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ scriptCmd opts = do
245245
-- to check which packages are installed already. If all needed
246246
-- packages are available, we can skip the (rather expensive) build
247247
-- call below.
248-
GhcPkgExe pkg <- view $ compilerPathsL . to (.cpPkg)
248+
GhcPkgExe pkg <- view $ compilerPathsL . to (.pkg)
249249
-- https://github.com/haskell/process/issues/251
250250
bss <- snd <$> sinkProcessStderrStdout (toFilePath pkg)
251251
["list", "--simple-output"] CL.sinkNull CL.consume -- FIXME use the package info from envConfigPackages, or is that crazy?
@@ -284,7 +284,7 @@ scriptCmd opts = do
284284
]
285285
case shouldCompile of
286286
SEInterpret -> do
287-
interpret <- view $ compilerPathsL . to (.cpInterpreter)
287+
interpret <- view $ compilerPathsL . to (.interpreter)
288288
exec (toFilePath interpret)
289289
(ghcArgs ++ toFilePath file : opts.soArgs)
290290
_ -> do
@@ -295,7 +295,7 @@ scriptCmd opts = do
295295
-- to the user.
296296
liftIO $ Dir.createDirectoryIfMissing True (fromAbsDir (parent exe))
297297
compilerExeName <-
298-
view $ compilerPathsL . to (.cpCompiler) . to toFilePath
298+
view $ compilerPathsL . to (.compiler) . to toFilePath
299299
withWorkingDir (fromAbsDir (parent file)) $ proc
300300
compilerExeName
301301
(ghcArgs ++ [toFilePath file])

src/Stack/Setup.hs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ setupEnv needTargets boptsCLI mResolveMissingGHC = do
667667
}
668668

669669
(compilerPaths, ghcBin) <- ensureCompilerAndMsys sopts
670-
let compilerVer = compilerPaths.cpCompilerVersion
670+
let compilerVer = compilerPaths.compilerVersion
671671

672672
-- Modify the initial environment to include the GHC path, if a local GHC
673673
-- is being used
@@ -712,12 +712,12 @@ setupEnv needTargets boptsCLI mResolveMissingGHC = do
712712
either throwM pure $ augmentPath (toFilePath <$> mkDirs True) mpath
713713

714714
deps <- runRIO envConfig0 packageDatabaseDeps
715-
runWithGHC menv compilerPaths $ createDatabase compilerPaths.cpPkg deps
715+
runWithGHC menv compilerPaths $ createDatabase compilerPaths.pkg deps
716716
localdb <- runRIO envConfig0 packageDatabaseLocal
717-
runWithGHC menv compilerPaths $ createDatabase compilerPaths.cpPkg localdb
717+
runWithGHC menv compilerPaths $ createDatabase compilerPaths.pkg localdb
718718
extras <- runReaderT packageDatabaseExtra envConfig0
719719
let mkGPP locals =
720-
mkGhcPackagePath locals localdb deps extras compilerPaths.cpGlobalDB
720+
mkGhcPackagePath locals localdb deps extras compilerPaths.globalDB
721721

722722
distDir <- runReaderT distRelativeDir envConfig0 >>= canonicalizePath
723723

@@ -788,7 +788,7 @@ setupEnv needTargets boptsCLI mResolveMissingGHC = do
788788
-- are ignored, since we're setting up our
789789
-- own package databases. See
790790
-- https://github.com/commercialhaskell/stack/issues/4706
791-
$ (case compilerPaths.cpCompilerVersion of
791+
$ (case compilerPaths.compilerVersion of
792792
ACGhc version | version >= mkVersion [8, 4, 4] ->
793793
Map.insert "GHC_ENVIRONMENT" "-"
794794
_ -> id)
@@ -1052,8 +1052,8 @@ warnUnsupportedCompilerCabal ::
10521052
-> RIO env ()
10531053
warnUnsupportedCompilerCabal cp didWarn = do
10541054
unless didWarn $
1055-
void $ warnUnsupportedCompiler $ getGhcVersion cp.cpCompilerVersion
1056-
let cabalVersion = cp.cpCabalVersion
1055+
void $ warnUnsupportedCompiler $ getGhcVersion cp.compilerVersion
1056+
let cabalVersion = cp.cabalVersion
10571057
notifyIfCabalUntested <- view $ configL . to (.notifyIfCabalUntested)
10581058
if
10591059
| cabalVersion < mkVersion [1, 24, 0] -> do
@@ -1222,9 +1222,9 @@ ensureCompiler sopts getSetupInfo' = do
12221222

12231223
let canUseCompiler cp
12241224
| sopts.skipGhcCheck = pure cp
1225-
| not $ isWanted cp.cpCompilerVersion =
1225+
| not $ isWanted cp.compilerVersion =
12261226
prettyThrowIO UnwantedCompilerVersion
1227-
| cp.cpArch /= expectedArch = prettyThrowIO UnwantedArchitecture
1227+
| cp.arch /= expectedArch = prettyThrowIO UnwantedArchitecture
12281228
| otherwise = pure cp
12291229
isWanted =
12301230
isWantedCompiler sopts.compilerCheck sopts.wantedCompiler
@@ -1259,7 +1259,7 @@ ensureCompiler sopts getSetupInfo' = do
12591259
Nothing -> ensureSandboxedCompiler sopts getSetupInfo'
12601260
Just cp -> do
12611261
let paths = ExtraDirs
1262-
{ edBins = [parent cp.cpCompiler]
1262+
{ edBins = [parent cp.compiler]
12631263
, edInclude = [], edLib = []
12641264
}
12651265
pure (cp, paths)
@@ -1504,18 +1504,18 @@ pathsFromCompiler wc compilerBuild isSandboxed compiler =
15041504
Just dp -> pure $ pkgVersion dp.packageIdent
15051505

15061506
pure CompilerPaths
1507-
{ cpBuild = compilerBuild
1508-
, cpArch = arch
1509-
, cpSandboxed = isSandboxed
1510-
, cpCompilerVersion = compilerVer
1511-
, cpCompiler = compiler
1512-
, cpPkg = pkg
1513-
, cpInterpreter = interpreter
1514-
, cpHaddock = haddock
1515-
, cpCabalVersion = cabalPkgVer
1516-
, cpGlobalDB = globaldb
1517-
, cpGhcInfo = infobs
1518-
, cpGlobalDump = globalDump
1507+
{ build = compilerBuild
1508+
, arch = arch
1509+
, sandboxed = isSandboxed
1510+
, compilerVersion = compilerVer
1511+
, compiler = compiler
1512+
, pkg = pkg
1513+
, interpreter = interpreter
1514+
, haddock = haddock
1515+
, cabalVersion = cabalPkgVer
1516+
, globalDB = globaldb
1517+
, ghcInfo = infobs
1518+
, globalDump = globalDump
15191519
}
15201520
where
15211521
onErr = throwIO . PrettyException . InvalidGhcAt compiler

0 commit comments

Comments
 (0)