diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-06-04 20:37:31 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-06-12 08:19:59 -0400 |
commit | 381c3ae31b68019177f1cd20cb4da2f9d3b7d6c6 (patch) | |
tree | 4d3110e3035a37536cd463046ce5c23d8e00151a /hadrian/src | |
parent | bd2d13ff778a4b1b5d793c99229cccfb64d792f3 (diff) | |
download | haskell-381c3ae31b68019177f1cd20cb4da2f9d3b7d6c6.tar.gz |
Bump Cabal submodule
(cherry picked from commit ff438786613f07df9b2d43eaeac49b13815d849d)
Metric Increase:
haddock.Cabal
Diffstat (limited to 'hadrian/src')
-rw-r--r-- | hadrian/src/Hadrian/Haskell/Cabal/Parse.hs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs index 347aa99b15..1c54a4e5d6 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 @@ -219,7 +220,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 @@ -306,7 +307,20 @@ buildAutogenFiles 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)) + |