Skip to content

Commit 995bbad

Browse files
authored
Merge pull request #6162 from juhp/distdir-ghcversion
distRelativeDir: use ghc version instead of Cabal version
2 parents c243318 + 51d697f commit 995bbad

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Major changes:
1313

1414
Behavior changes:
1515

16+
* The path dist directory path '.stack-work/dist/<platform>/Cabal-*/'
17+
changes to '.stack-work/dist/<platform>/ghc-*/' so that build artifacts are
18+
clearly distinguished by ghc version.
19+
1620
Other enhancements:
1721

1822
* Avoid the duplicate resolving of usage files when parsing `*.hi` files into a

src/Stack/Constants/Config.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ module Stack.Constants.Config
2424
) where
2525

2626
import Path ( (</>), mkRelDir, mkRelFile, parseRelDir )
27-
import Stack.Constants
28-
( cabalPackageName, relDirDist, relDirGhci, relDirHpc )
27+
import Stack.Constants ( relDirDist, relDirGhci, relDirHpc )
2928
import Stack.Prelude
3029
import Stack.Types.BuildConfig ( HasBuildConfig, projectRootL )
31-
import Stack.Types.CompilerPaths ( cabalVersionL )
30+
import Stack.Types.Compiler ( compilerVersionString )
31+
import Stack.Types.CompilerPaths ( compilerVersionL )
3232
import Stack.Types.Config ( Config, HasConfig, stackRootL, workDirL )
3333
import Stack.Types.EnvConfig
3434
( HasEnvConfig, platformGhcRelDir, useShaPathOnWindows )
@@ -162,13 +162,11 @@ templatesDir config = view stackRootL config </> $(mkRelDir "templates")
162162
distRelativeDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env)
163163
=> m (Path Rel Dir)
164164
distRelativeDir = do
165-
cabalPkgVer <- view cabalVersionL
165+
compilerVer <- view compilerVersionL
166166
platform <- platformGhcRelDir
167167
-- Cabal version
168168
envDir <-
169-
parseRelDir $
170-
packageIdentifierString $
171-
PackageIdentifier cabalPackageName cabalPkgVer
169+
parseRelDir $ compilerVersionString compilerVer
172170
platformAndCabal <- useShaPathOnWindows (platform </> envDir)
173171
allDist <- rootDistRelativeDir
174172
pure $ allDist </> platformAndCabal

src/Stack/Types/CompilerPaths.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Stack.Types.CompilerPaths
55
, GhcPkgExe (..)
66
, HasCompiler (..)
77
, cabalVersionL
8+
, compilerVersionL
89
, cpWhich
910
, getCompilerPath
1011
, getGhcPkgExe
@@ -62,6 +63,9 @@ newtype GhcPkgExe
6263
cabalVersionL :: HasCompiler env => SimpleGetter env Version
6364
cabalVersionL = compilerPathsL.to cpCabalVersion
6465

66+
compilerVersionL :: HasCompiler env => SimpleGetter env ActualCompiler
67+
compilerVersionL = compilerPathsL.to cpCompilerVersion
68+
6569
cpWhich :: (MonadReader env m, HasCompiler env) => m WhichCompiler
6670
cpWhich = view $ compilerPathsL.to (whichCompiler.cpCompilerVersion)
6771

0 commit comments

Comments
 (0)