summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadrian/hadrian.cabal2
-rw-r--r--hadrian/src/Hadrian/Haskell/Cabal/Parse.hs20
m---------libraries/Cabal0
-rw-r--r--testsuite/tests/driver/T4437.hs5
-rw-r--r--utils/check-api-annotations/check-api-annotations.cabal2
-rw-r--r--utils/check-ppr/check-ppr.cabal2
-rw-r--r--utils/ghc-cabal/Main.hs21
-rw-r--r--utils/ghc-cabal/ghc-cabal.cabal2
-rw-r--r--utils/ghctags/ghctags.cabal2
9 files changed, 42 insertions, 14 deletions
diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal
index 669d16c776..2ed325a781 100644
--- a/hadrian/hadrian.cabal
+++ b/hadrian/hadrian.cabal
@@ -116,7 +116,7 @@ executable hadrian
other-extensions: MultiParamTypeClasses
, TypeFamilies
build-depends: base >= 4.8 && < 5
- , Cabal >= 2.5 && < 2.6
+ , Cabal >= 3.0 && < 3.1
, containers >= 0.5 && < 0.7
, directory >= 1.2 && < 1.4
, extra >= 1.4.7
diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
index 8df343b423..e527482e9c 100644
--- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
+++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -Wno-deprecations #-}
-----------------------------------------------------------------------------
-- |
-- Module : Hadrian.Haskell.Cabal.Parse
@@ -17,6 +16,7 @@ module Hadrian.Haskell.Cabal.Parse (
import Data.Bifunctor
import Data.List.Extra
import Development.Shake
+import qualified Distribution.Compat.Graph as Graph
import qualified Distribution.ModuleName as C
import qualified Distribution.Package as C
import qualified Distribution.PackageDescription as C
@@ -30,6 +30,7 @@ import qualified Distribution.Simple.Utils as C
import qualified Distribution.Simple.Program.Types as C
import qualified Distribution.Simple.Configure as C (getPersistBuildConfig)
import qualified Distribution.Simple.Build as C
+import qualified Distribution.Types.ComponentLocalBuildInfo as C
import qualified Distribution.Types.ComponentRequestedSpec as C
import qualified Distribution.InstalledPackageInfo as Installed
import qualified Distribution.Simple.PackageIndex as C
@@ -215,7 +216,7 @@ resolveContextData context@Context {..} = do
-- TODO: Get rid of deprecated 'externalPackageDeps' and drop -Wno-deprecations
-- See: https://github.com/snowleopard/hadrian/issues/548
- let extDeps = C.externalPackageDeps lbi'
+ let extDeps = externalPackageDeps lbi'
deps = map (C.display . snd) extDeps
depDirect = map (fromMaybe (error "resolveContextData: depDirect failed")
. C.lookupUnitId (C.installedPkgs lbi') . fst) extDeps
@@ -288,7 +289,20 @@ resolveContextData context@Context {..} = do
getHookedBuildInfo :: [FilePath] -> IO C.HookedBuildInfo
getHookedBuildInfo [] = return C.emptyHookedBuildInfo
getHookedBuildInfo (baseDir:baseDirs) = do
- maybeInfoFile <- C.findHookedPackageDesc baseDir
+ maybeInfoFile <- C.findHookedPackageDesc C.normal baseDir
case maybeInfoFile of
Nothing -> getHookedBuildInfo baseDirs
Just infoFile -> C.readHookedBuildInfo C.silent infoFile
+
+externalPackageDeps :: C.LocalBuildInfo -> [(C.UnitId, C.MungedPackageId)]
+externalPackageDeps lbi =
+ -- TODO: what about non-buildable components?
+ nub [ (ipkgid, pkgid)
+ | clbi <- Graph.toList (C.componentGraph lbi)
+ , (ipkgid, pkgid) <- C.componentPackageDeps clbi
+ , not (internal ipkgid) ]
+ where
+ -- True if this dependency is an internal one (depends on the library
+ -- defined in the same package).
+ internal ipkgid = any ((==ipkgid) . C.componentUnitId) (Graph.toList (C.componentGraph lbi))
+
diff --git a/libraries/Cabal b/libraries/Cabal
-Subproject 27fc0fe9608ba502ef62647629a6d4ebe01fa33
+Subproject f697d3209990c3314efe840be54fb7c5a967e6f
diff --git a/testsuite/tests/driver/T4437.hs b/testsuite/tests/driver/T4437.hs
index 5ae423086a..5ffd42a3a4 100644
--- a/testsuite/tests/driver/T4437.hs
+++ b/testsuite/tests/driver/T4437.hs
@@ -38,9 +38,8 @@ check title expected got
expectedGhcOnlyExtensions :: [String]
expectedGhcOnlyExtensions = ["RelaxedLayout",
"AlternativeLayoutRule",
- "AlternativeLayoutRuleTransitional",
- "EmptyDataDeriving",
- "GeneralisedNewtypeDeriving"]
+ "AlternativeLayoutRuleTransitional"
+ ]
expectedCabalOnlyExtensions :: [String]
expectedCabalOnlyExtensions = ["Generics",
diff --git a/utils/check-api-annotations/check-api-annotations.cabal b/utils/check-api-annotations/check-api-annotations.cabal
index bc9698c16e..12d088437b 100644
--- a/utils/check-api-annotations/check-api-annotations.cabal
+++ b/utils/check-api-annotations/check-api-annotations.cabal
@@ -24,6 +24,6 @@ Executable check-api-annotations
Build-Depends: base >= 4 && < 5,
containers,
- Cabal >= 2.5 && < 2.6,
+ Cabal >= 3.0 && < 3.1,
directory,
ghc
diff --git a/utils/check-ppr/check-ppr.cabal b/utils/check-ppr/check-ppr.cabal
index 4257a88471..2438724636 100644
--- a/utils/check-ppr/check-ppr.cabal
+++ b/utils/check-ppr/check-ppr.cabal
@@ -25,7 +25,7 @@ Executable check-ppr
Build-Depends: base >= 4 && < 5,
bytestring,
containers,
- Cabal >= 2.5 && < 2.6,
+ Cabal >= 3.0 && < 3.1,
directory,
filepath,
ghc
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index 8b776499fd..0782ead535 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -19,8 +19,10 @@ import Distribution.Simple.Utils (defaultPackageDesc, findHookedPackageDesc, wri
toUTF8LBS)
import Distribution.Simple.Build (writeAutogenFiles)
import Distribution.Simple.Register
+import qualified Distribution.Compat.Graph as Graph
import Distribution.Text
import Distribution.Types.MungedPackageId
+import Distribution.Types.LocalBuildInfo
import Distribution.Verbosity
import qualified Distribution.InstalledPackageInfo as Installed
import qualified Distribution.Simple.PackageIndex as PackageIndex
@@ -251,6 +253,18 @@ updateInstallDirTemplates relocatableBuild myPrefix myLibdir myDocdir idts
htmldir = toPathTemplate "$docdir"
}
+externalPackageDeps :: LocalBuildInfo -> [(UnitId, MungedPackageId)]
+externalPackageDeps lbi =
+ -- TODO: what about non-buildable components?
+ nub [ (ipkgid, pkgid)
+ | clbi <- Graph.toList (componentGraph lbi)
+ , (ipkgid, pkgid) <- componentPackageDeps clbi
+ , not (internal ipkgid) ]
+ where
+ -- True if this dependency is an internal one (depends on the library
+ -- defined in the same package).
+ internal ipkgid = any ((==ipkgid) . componentUnitId) (Graph.toList (componentGraph lbi))
+
generate :: FilePath -> FilePath -> [String] -> IO ()
generate directory distdir config_args
= withCurrentDirectory directory
@@ -274,8 +288,8 @@ generate directory distdir config_args
-- cabal 2.2+ will expect it, but fallback to the old default
-- location if we don't find any. This is the case of the
-- bindist, which doesn't ship the $dist/build folder.
- maybe_infoFile <- findHookedPackageDesc (cwd </> distdir </> "build")
- <|> defaultHookedPackageDesc
+ maybe_infoFile <- findHookedPackageDesc verbosity (cwd </> distdir </> "build")
+ <|> fmap Just (defaultPackageDesc verbosity)
case maybe_infoFile of
Nothing -> return emptyHookedBuildInfo
Just infoFile -> readHookedBuildInfo verbosity infoFile
@@ -307,8 +321,9 @@ generate directory distdir config_args
let
comp = compiler lbi
- libBiModules lib = (libBuildInfo lib, libModules lib)
+ libBiModules lib = (libBuildInfo lib, foldMap (allLibModules lib) (componentNameCLBIs lbi $ CLibName defaultLibName))
exeBiModules exe = (buildInfo exe, ModuleName.main : exeModules exe)
+ biModuless :: [(BuildInfo, [ModuleName.ModuleName])]
biModuless = (map libBiModules . maybeToList $ library pd)
++ (map exeBiModules $ executables pd)
buildableBiModuless = filter isBuildable biModuless
diff --git a/utils/ghc-cabal/ghc-cabal.cabal b/utils/ghc-cabal/ghc-cabal.cabal
index c2512c1ca7..3176e5d3ab 100644
--- a/utils/ghc-cabal/ghc-cabal.cabal
+++ b/utils/ghc-cabal/ghc-cabal.cabal
@@ -21,7 +21,7 @@ Executable ghc-cabal
Build-Depends: base >= 3 && < 5,
bytestring >= 0.10 && < 0.11,
- Cabal >= 2.5 && < 2.6,
+ Cabal >= 3.0 && < 3.1,
directory >= 1.1 && < 1.4,
filepath >= 1.2 && < 1.5
diff --git a/utils/ghctags/ghctags.cabal b/utils/ghctags/ghctags.cabal
index 23de1524b9..c315b8b50b 100644
--- a/utils/ghctags/ghctags.cabal
+++ b/utils/ghctags/ghctags.cabal
@@ -18,6 +18,6 @@ Executable ghctags
Build-Depends: base >= 4 && < 5,
containers,
- Cabal >= 2.5 && <2.6,
+ Cabal >= 3.0 && <3.1,
ghc