Skip to content

Commit

Permalink
Fix Cabal API changes: NubListR, extra tuple parameter, Version -> Co…
Browse files Browse the repository at this point in the history
…mpiler
  • Loading branch information
Daniel Ward committed Mar 26, 2015
1 parent dec9235 commit 05294e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
13 changes: 3 additions & 10 deletions hdevtools.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: hdevtools
version: 0.1.0.6
version: 0.1.0.7
synopsis: Persistent GHC powered background server for FAST haskell development tools
description:
'hdevtools' is a backend for text editor plugins, to allow for things such as
Expand Down Expand Up @@ -59,20 +59,13 @@ executable hdevtools
Util,
Paths_hdevtools
build-depends: base == 4.*,
Cabal >= 1.22,
cmdargs,
directory,
filepath,
ghc >= 7.2,
ghc >= 7.10,
ghc-paths,
syb,
network,
time,
unix

if impl(ghc == 7.6.*)
build-depends: Cabal == 1.16.*
cpp-options: -DENABLE_CABAL

if impl(ghc >= 7.7)
build-depends: Cabal >= 1.18
cpp-options: -DENABLE_CABAL
12 changes: 8 additions & 4 deletions src/Cabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), ComponentLocalBui
componentBuildInfo, foldComponent)
import Distribution.Simple.Compiler (PackageDB(..))
import Distribution.Simple.GHC (componentGhcOptions)
import qualified Distribution.Simple.GHC as GHC(configure)
import Distribution.Simple.Program (defaultProgramConfiguration)
import Distribution.Simple.Program.Db (lookupProgram)
import Distribution.Simple.Program.Types (ConfiguredProgram(programVersion), simpleProgram)
import Distribution.Simple.Program.GHC (GhcOptions(..), renderGhcOptions)
import Distribution.Simple.Setup (ConfigFlags(..), defaultConfigFlags, toFlag)
import Distribution.Utils.NubList
import Distribution.Verbosity (silent)
import Distribution.Version (Version(..))

Expand Down Expand Up @@ -127,13 +129,15 @@ getPackageGhcOpts path = do

let ghcOpts' = foldl' mappend mempty $ map (getComponentGhcOptions localBuildInfo) $ flip allComponentsBy (\c -> c) . localPkgDescr $ localBuildInfo
-- FIX bug in GhcOptions' `mappend`
ghcOpts = ghcOpts' { ghcOptExtra = filter (/= "-Werror") $ nub $ ghcOptExtra ghcOpts'
ghcOpts = ghcOpts' { ghcOptExtra = overNubListR (filter (/= "-Werror")) $ ghcOptExtra ghcOpts'
, ghcOptPackageDBs = sort $ nub (ghcOptPackageDBs ghcOpts')
, ghcOptPackages = filter (\(_, pkgId) -> Just (pkgName pkgId) /= mbLibName) $ nub (ghcOptPackages ghcOpts')
, ghcOptSourcePath = map (baseDir </>) (ghcOptSourcePath ghcOpts')
, ghcOptPackages = overNubListR (filter (\(_, pkgId, _) -> Just (pkgName pkgId) /= mbLibName)) $ (ghcOptPackages ghcOpts')
, ghcOptSourcePath = overNubListR (map (baseDir </>)) (ghcOptSourcePath ghcOpts')
}

return $ Right $ renderGhcOptions ghcVersion ghcOpts
(ghcInfo,_,_) <- GHC.configure silent (Just path) Nothing defaultProgramConfiguration

return $ Right $ renderGhcOptions ghcInfo ghcOpts

pkgLibName :: PackageDescription -> Maybe PackageName
pkgLibName pkgDescr = if hasLibrary pkgDescr
Expand Down

0 comments on commit 05294e6

Please sign in to comment.