From c2d116272b448342629e6beb73fe7a464e2245d3 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 14 Feb 2016 13:20:53 +0100 Subject: Cabal 1.24 readiness (GHC 8) --- CabalHelper/Licenses.hs | 14 +++++++++----- CabalHelper/Main.hs | 15 ++++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'CabalHelper') diff --git a/CabalHelper/Licenses.hs b/CabalHelper/Licenses.hs index eeebae7..4660c15 100644 --- a/CabalHelper/Licenses.hs +++ b/CabalHelper/Licenses.hs @@ -33,11 +33,15 @@ type CPackageIndex a = PackageIndex (InstalledPackageInfo_ a) type CPackageIndex a = PackageIndex #endif -#if CABAL_MAJOR == 1 && CABAL_MINOR > 22 +#if CABAL_MAJOR == 1 && CABAL_MINOR >= 23 +type CInstalledPackageId = UnitId +lookupInstalledPackageId' = lookupUnitId +#elif CABAL_MAJOR == 1 && CABAL_MINOR > 22 type CInstalledPackageId = ComponentId -lookupInstalledPackageId = lookupComponentId +lookupInstalledPackageId' = lookupComponentId #else type CInstalledPackageId = InstalledPackageId +lookupInstalledPackageId' = lookupInstalledPackageId #endif findTransitiveDependencies @@ -50,7 +54,7 @@ findTransitiveDependencies pkgIdx set0 = go Set.empty (Set.toList set0) go set (q : queue) | q `Set.member` set = go set queue | otherwise = - case lookupInstalledPackageId pkgIdx q of + case lookupInstalledPackageId' pkgIdx q of Nothing -> -- Not found can mean that the package still needs to be -- installed (e.g. a component of the target cabal package). @@ -62,7 +66,7 @@ findTransitiveDependencies pkgIdx set0 = go Set.empty (Set.toList set0) -------------------------------------------------------------------------------- getDependencyInstalledPackageIds - :: LocalBuildInfo -> Set InstalledPackageId + :: LocalBuildInfo -> Set CInstalledPackageId getDependencyInstalledPackageIds lbi = findTransitiveDependencies (installedPkgs lbi) $ Set.fromList $ map fst $ externalPackageDeps lbi @@ -71,7 +75,7 @@ getDependencyInstalledPackageIds lbi = getDependencyInstalledPackageInfos :: LocalBuildInfo -> [InstalledPackageInfo] getDependencyInstalledPackageInfos lbi = catMaybes $ - map (lookupInstalledPackageId pkgIdx) $ + map (lookupInstalledPackageId' pkgIdx) $ Set.toList (getDependencyInstalledPackageIds lbi) where pkgIdx = installedPkgs lbi diff --git a/CabalHelper/Main.hs b/CabalHelper/Main.hs index 2244859..2170d30 100644 --- a/CabalHelper/Main.hs +++ b/CabalHelper/Main.hs @@ -48,10 +48,10 @@ import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), externalPackageDeps, withComponentsLBI, withLibLBI) -#if CABAL_MAJOR == 1 && CABAL_MINOR <= 22 +#if CABAL_MAJOR == 1 && CABAL_MINOR >= 23 +import Distribution.Simple.LocalBuildInfo (localUnitId) +#elif CABAL_MAJOR == 1 && CABAL_MINOR <= 22 import Distribution.Simple.LocalBuildInfo (inplacePackageId) -#else -import Distribution.Simple.LocalBuildInfo (localComponentId) #endif import Distribution.Simple.GHC (componentGhcOptions) @@ -413,7 +413,7 @@ removeInplaceDeps v lbi pd clbi = let liboutdir = componentOutDir lbi (CLib lib) libopts = (componentGhcOptions normal lbi libbi libclbi liboutdir) { ghcOptPackageDBs = [] -#if CABAL_MAJOR == 1 && CABAL_MINOR > 22 +#if CABAL_MAJOR == 1 && CABAL_MINOR > 22 && CABAL_MINOR < 23 , ghcOptComponentId = NoFlag #endif } @@ -426,10 +426,11 @@ removeInplaceDeps v lbi pd clbi = let where isInplaceDep :: (InstalledPackageId, PackageId) -> Bool -#if CABAL_MAJOR == 1 && CABAL_MINOR <= 22 +#if CABAL_MAJOR == 1 && CABAL_MINOR >= 23 + isInplaceDep (ipid, pid) = localUnitId lbi == ipid +#elif CABAL_MAJOR == 1 && CABAL_MINOR <= 22 isInplaceDep (ipid, pid) = inplacePackageId pid == ipid -#else - isInplaceDep (ipid, pid) = localComponentId lbi == ipid + #endif -- cgit v1.2.3