From f949e4be7aa654b0dc3c027ef7cfad6f4d7268ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Sat, 10 May 2014 02:04:09 +0200 Subject: [PATCH] Copy ComponentLocalBuildInfo from Cabal-1.18 This way `configDependencies` works even when the Cabal version used by cabal-install is later than the one used by ghc-mod. --- Language/Haskell/GhcMod/Cabal18.hs | 21 ++++++++++++++++++++- test/Main.hs | 3 ++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Language/Haskell/GhcMod/Cabal18.hs b/Language/Haskell/GhcMod/Cabal18.hs index e30433a..69c80a2 100644 --- a/Language/Haskell/GhcMod/Cabal18.hs +++ b/Language/Haskell/GhcMod/Cabal18.hs @@ -4,4 +4,23 @@ module Language.Haskell.GhcMod.Cabal18 ( , componentPackageDeps ) where -import Distribution.Simple.LocalBuildInfo (ComponentLocalBuildInfo(..)) +import Distribution.Package (InstalledPackageId, PackageId) + +data LibraryName = LibraryName String + deriving (Read, Show) + +data ComponentLocalBuildInfo + = LibComponentLocalBuildInfo { + componentPackageDeps :: [(InstalledPackageId, PackageId)], + componentLibraries :: [LibraryName] + } + | ExeComponentLocalBuildInfo { + componentPackageDeps :: [(InstalledPackageId, PackageId)] + } + | TestComponentLocalBuildInfo { + componentPackageDeps :: [(InstalledPackageId, PackageId)] + } + | BenchComponentLocalBuildInfo { + componentPackageDeps :: [(InstalledPackageId, PackageId)] + } + deriving (Read, Show) diff --git a/test/Main.hs b/test/Main.hs index 0700432..f7a0820 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE CPP, ScopedTypeVariables #-} import Spec import Dir @@ -22,6 +22,7 @@ main = do genGhcPkgCache `mapM_` pkgDirs system "find test -name setup-config -exec rm {} \\;" system "cabal --version" + putStrLn $ "ghc-mod was built with Cabal version " ++ VERSION_Cabal system "ghc --version" (putStrLn =<< debugInfo defaultOptions =<< findCradle)