3
3
4
4
module StackSetupShim where
5
5
6
- -- | Stack no longer supports Cabal < 2.2 and, consequently, GHC versions before
7
- -- GHC 8.4 or base < 4.11 .0.0. Consequently, we do not need to test for the
8
- -- existence of the MIN_VERSION_Cabal macro (provided from GHC 8.0).
6
+ -- | Stack no longer supports Cabal < 1.24 and, consequently, GHC versions
7
+ -- before GHC 8.0 or base < 4.9 .0.0. Consequently, we do not need to test for
8
+ -- the existence of the MIN_VERSION_Cabal macro (provided from GHC 8.0).
9
9
10
10
import Data.List ( stripPrefix )
11
11
import Distribution.ReadE ( ReadE (.. ) )
@@ -26,20 +26,32 @@ import Distribution.Simple.LocalBuildInfo
26
26
#endif
27
27
#if MIN_VERSION_Cabal(3,8,1)
28
28
import Distribution.Simple.PackageDescription ( readGenericPackageDescription )
29
- #else
30
- -- Avoid confusion with Cabal-syntax module of same name
29
+ #elif MIN_VERSION_Cabal(2,2,0)
30
+ -- Avoid confusion with Cabal-syntax module of same name.
31
+ -- readGenericPackageDescription was exported from module
32
+ -- Distribution.PackageDescription.Parsec in Cabal-2.2.0.0.
31
33
import "Cabal " Distribution.PackageDescription.Parsec
32
34
( readGenericPackageDescription )
35
+ #elif MIN_VERSION_Cabal(2,0,0)
36
+ -- readPackageDescription was renamed readGenericPackageDescription in
37
+ -- Cabal-2.0.0.2.
38
+ import Distribution.PackageDescription.Parse ( readGenericPackageDescription )
39
+ #else
40
+ import Distribution.PackageDescription.Parse ( readPackageDescription )
33
41
#endif
34
42
import Distribution.Simple.Utils
35
43
( createDirectoryIfMissingVerbose , findPackageDesc )
36
44
#if MIN_VERSION_Cabal(3,8,1)
37
45
import Distribution.Types.GenericPackageDescription
38
46
( GenericPackageDescription (.. ) )
39
- #else
40
- -- Avoid confusion with Cabal-syntax module of same name
47
+ #elif MIN_VERSION_Cabal(2,0,0)
48
+ -- Avoid confusion with Cabal-syntax module of same name.
49
+ -- GenericPackageDescription was exported from module
50
+ -- Distribution.Types.GenericPackageDescription in Cabal-2.0.0.2.
41
51
import "Cabal " Distribution.Types.GenericPackageDescription
42
52
( GenericPackageDescription (.. ) )
53
+ #else
54
+ import Distribution.PackageDescription ( GenericPackageDescription (.. ) )
43
55
#endif
44
56
-- | Temporary, can be removed if initialBuildSteps restored to Cabal's API.
45
57
#if MIN_VERSION_Cabal(3,11,0)
@@ -50,6 +62,10 @@ import Distribution.Verbosity ( Verbosity )
50
62
#endif
51
63
import Distribution.Verbosity ( flagToVerbosity )
52
64
import Main
65
+ -- Before base-4.11.0.0 (GHC 8.4.1), <> was not exported by Prelude.
66
+ #if !MIN_VERSION_base(4,11,0)
67
+ import Data.Semigroup ( (<>) )
68
+ #endif
53
69
import System.Environment ( getArgs )
54
70
55
71
mainOverride :: IO ()
@@ -99,7 +115,12 @@ stackReplHook arg1 arg2 = do
99
115
msg2 = err
100
116
#endif
101
117
Right fp -> do
102
- gpd <- readGenericPackageDescription verbosity fp
118
+ gpd <-
119
+ #if MIN_VERSION_Cabal(2,0,0)
120
+ readGenericPackageDescription verbosity fp
121
+ #else
122
+ readPackageDescription verbosity fp
123
+ #endif
103
124
let pd = packageDescription gpd
104
125
lbi <- getPersistBuildConfig rawBuildDir
105
126
initialBuildSteps rawBuildDir pd lbi verbosity
0 commit comments