Skip to content

Commit

Permalink
Merge https://github.com/adituv/hdevtools into adituv-master
Browse files Browse the repository at this point in the history
  • Loading branch information
schell committed Apr 6, 2015
2 parents 5a9b65f + 05294e6 commit c7acb5a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
11 changes: 2 additions & 9 deletions hdevtools.cabal
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion src/Info.hs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ everythingStaged stage k z f x
| (const False `extQ` postTcType `extQ` fixity `extQ` nameSet) x = z
| otherwise = foldl k (f x) (gmapQ (everythingStaged stage k z f) x)
where nameSet = const (stage `elem` [Parser,TypeChecker]) :: NameSet.NameSet -> Bool
postTcType = const (stage<TypeChecker) :: GHC.PostTcType -> Bool
postTcType = const (stage<TypeChecker) :: GHC.PostTc GHC.Id GHC.Type -> Bool
fixity = const (stage<Renamer) :: GHC.Fixity -> Bool

------------------------------------------------------------------------------
Expand Down

0 comments on commit c7acb5a

Please sign in to comment.