From ba281ba9b27a3098c3d86cb5ab0eaddc9760d245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Fri, 23 Dec 2016 15:42:31 +0100 Subject: [PATCH] Cleanup ghc-mod.cabal - Remove X-Depends-Like to relax Cabal dependency back to 1.18 (for ghc-7.8) - Reorganize build-depends - Remove bounds from GHC boot libraries to make maintenance easier --- Setup.hs | 47 -------------- bench/Bench.hs | 3 +- ghc-mod.cabal | 171 ++++++++++++++++++++++++++++--------------------- 3 files changed, 101 insertions(+), 120 deletions(-) diff --git a/Setup.hs b/Setup.hs index 888994383..b8dc0cbe8 100755 --- a/Setup.hs +++ b/Setup.hs @@ -29,10 +29,6 @@ main :: IO () main = defaultMainWithHooks $ simpleUserHooks { instHook = inst, copyHook = copy, - - confHook = \(gpd, hbi) cf -> - xBuildDependsLike <$> (confHook simpleUserHooks) (gpd, hbi) cf, - buildHook = \pd lbi hooks flags -> (buildHook simpleUserHooks) pd (patchLibexecdir lbi) hooks flags } @@ -44,49 +40,6 @@ patchLibexecdir lbi = let in lbi' - -xBuildDependsLike :: LocalBuildInfo -> LocalBuildInfo -xBuildDependsLike lbi = - let - cc = componentsConfigs lbi - pd = localPkgDescr lbi - deps = dependsMap lbi - in lbi { - componentsConfigs = - [ (cn, updateClbi deps comp clbi, cdeps) - | (cn, clbi, cdeps) <- cc - , let comp = getComponent pd cn - ] - } - where - updateClbi deps comp clbi = setUnionDeps (otherDeps deps comp) clbi - --- dependsMap :: --- LocalBuildInfo -> [(ComponentName, ([(UnitId, PackageId)], Map PackageName ModuleRenaming))] - dependsMap lbi = - second (componentPackageDeps &&& componentPackageRenaming) - <$> allComponentsInBuildOrder lbi - --- otherDeps :: [(ComponentName, ([(UnitId, PackageId)], Map PackageName ModuleRenaming))] -> Component -> ([(UnitId, PackageId)], Map PackageName ModuleRenaming) - otherDeps deps comp = fromMaybe ([], M.empty) $ - flip lookup deps =<< read <$> lookup "x-build-depends-like" fields - where - fields = customFieldsBI (componentBuildInfo comp) - - setComponentPackageRenaming clbi cprn = - clbi { componentPackageRenaming = - componentPackageRenaming clbi `M.union` cprn } - --- setUnionDeps :: ([(UnitId, PackageId)], Map PackageName ModuleRenaming) -> ComponentLocalBuildInfo -> ComponentLocalBuildInfo - setUnionDeps (deps, rns) clbi = let - clbi' = setComponentPackageRenaming clbi rns - cpdeps = componentPackageDeps clbi - in - clbi' { - componentPackageDeps = cpdeps `union` deps - } - - -- mostly copypasta from 'defaultInstallHook' inst :: PackageDescription -> LocalBuildInfo -> UserHooks -> InstallFlags -> IO () diff --git a/bench/Bench.hs b/bench/Bench.hs index 93bf14449..18804922b 100644 --- a/bench/Bench.hs +++ b/bench/Bench.hs @@ -1,6 +1,7 @@ import Criterion.Main import Language.Haskell.GhcMod.Target -import TestUtils +import Language.Haskell.GhcMod.Monad +import Language.Haskell.GhcMod.Types import Dir import System.IO.Temp import System.Process hiding (env) diff --git a/ghc-mod.cabal b/ghc-mod.cabal index 7220dcc6b..34d36b3b4 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -25,7 +25,7 @@ Description: For more information, please see its home page. Category: GHC, Development -Cabal-Version: >= 1.24 +Cabal-Version: >= 1.18 Build-Type: Custom Data-Files: elisp/Makefile elisp/*.el @@ -98,7 +98,7 @@ Extra-Source-Files: ChangeLog Custom-Setup Setup-Depends: base - , Cabal >= 1.24 && < 1.25 + , Cabal >= 1.18 && < 1.25 , containers , filepath , directory @@ -171,40 +171,45 @@ Library Utils Data.Binary.Generic System.Directory.ModTime - Build-Depends: base < 5 && >= 4.0 - , bytestring < 0.11 - , binary < 0.9 && >= 0.5.1.0 - , containers < 0.6 - , cabal-helper < 0.8 && >= 0.7.1.0 - , deepseq < 1.5 - , directory < 1.3 - , filepath < 1.5 - , ghc < 8.2 && >= 7.6 - , ghc-paths < 0.2 && >= 0.1.0.9 - , ghc-syb-utils < 0.3 && >= 0.2.3 - , hlint < 1.10 && >= 1.9.27 - , monad-journal < 0.8 && >= 0.4 - , old-time < 1.2 - , process < 1.5 - , syb < 0.7 && >= 0.5.1 - , temporary < 1.3 && >= 1.2.0.3 - , transformers < 0.6 - , time < 1.7 - , transformers-base < 0.5 && >= 0.4.4 - , mtl < 2.3 && >= 2.0 - , monad-control < 1.1 && >= 1 - , split < 0.3 && >= 0.2.2 - , haskell-src-exts < 1.20 && >= 1.18 - , text < 1.3 && >= 1.2.1.3 - , djinn-ghc < 0.1 && >= 0.0.2.2 - , fclabels < 2.1 && >= 2.0 - , extra < 1.6 && >= 1.4 - , pipes < 4.4 && >= 4.1 - , safe < 0.4 && >= 0.3.9 - , optparse-applicative <0.13.0 && >=0.11.0 + Build-Depends: + -- See Note [GHC Boot libraries] + base + , binary + , bytestring + , containers + , deepseq + , directory + , filepath + , mtl + , old-time + , process , template-haskell - if impl(ghc < 7.8) - Build-Depends: convertible < 1.2 && >= 1.1.0.0 + , time + , transformers + + , djinn-ghc < 0.1 && >= 0.0.2.2 + , extra < 1.6 && >= 1.4 + , fclabels < 2.1 && >= 2.0 + , ghc-paths < 0.2 && >= 0.1.0.9 + , ghc-syb-utils < 0.3 && >= 0.2.3 + , haskell-src-exts < 1.20 && >= 1.18 + , hlint < 1.10 && >= 1.9.27 + , monad-control < 1.1 && >= 1 + , monad-journal < 0.8 && >= 0.4 + , optparse-applicative < 0.13 && >= 0.11.0 + , pipes < 4.4 && >= 4.1 + , safe < 0.4 && >= 0.3.9 + , split < 0.3 && >= 0.2.2 + , syb < 0.7 && >= 0.5.1 + , temporary < 1.3 && >= 1.2.0.3 + , text < 1.3 && >= 1.2.1.3 + , transformers-base < 0.5 && >= 0.4.4 + + , cabal-helper < 0.8 && >= 0.7.1.0 + , ghc < 8.2 && >= 7.6 + + if impl(ghc < 7.8) + Build-Depends: convertible < 1.2 && >= 1.1.0.0 if impl(ghc >= 8.0) Build-Depends: ghc-boot @@ -235,18 +240,21 @@ Executable ghc-mod-real GHC-Options: -Wall -fno-warn-deprecations -threaded Default-Extensions: ConstraintKinds, FlexibleContexts HS-Source-Dirs: src - Build-Depends: base < 5 && >= 4.0 - , directory < 1.3 - , filepath < 1.5 - , process < 1.5 - , split < 0.3 && >= 0.2.2 - , mtl < 2.3 && >= 2.0 - , ghc < 8.2 && >= 7.6 - , monad-control < 1.1 && >= 1 - , fclabels == 2.0.* - , optparse-applicative >=0.11.0 && <0.13.0 - , ghc-mod X-Internal: True + Build-Depends: + base + , directory + , filepath + , mtl + , process + + , fclabels < 2.1 && >= 2.0 + , monad-control < 1.1 && >= 1 + , optparse-applicative < 0.13 && >= 0.11.0 + , split < 0.3 && >= 0.2.2 + + , ghc < 8.2 && >= 7.6 + , ghc-mod Executable ghc-modi @@ -259,14 +267,17 @@ Executable ghc-modi Cpp-Options: -DWINDOWS Default-Extensions: ConstraintKinds, FlexibleContexts HS-Source-Dirs: src, . - Build-Depends: base < 5 && >= 4.0 - , binary < 0.9 && >= 0.5.1.0 - , deepseq < 1.5 - , directory < 1.3 - , filepath < 1.5 - , process < 1.5 - , old-time < 1.2 - , time < 1.7 + Build-Depends: + -- See Note [GHC Boot libraries] + base + , binary + , deepseq + , directory + , filepath + , old-time + , process + , time + , ghc-mod Test-Suite doctest @@ -277,7 +288,7 @@ Test-Suite doctest Default-Extensions: ConstraintKinds, FlexibleContexts Main-Is: doctests.hs Build-Depends: base - , doctest < 0.12 && >= 0.9.3 + , doctest < 0.12 && >= 0.9.3 Test-Suite spec Default-Language: Haskell2010 @@ -285,7 +296,7 @@ Test-Suite spec ConstraintKinds, FlexibleContexts, DataKinds, KindSignatures, TypeOperators, ViewPatterns Main-Is: Main.hs - Hs-Source-Dirs: test, ., src + Hs-Source-Dirs: test, src Ghc-Options: -Wall -fno-warn-deprecations -threaded CPP-Options: -DSPEC=1 Type: exitcode-stdio-1.0 @@ -307,8 +318,26 @@ Test-Suite spec FileMappingSpec ShellParseSpec - Build-Depends: hspec < 2.4 && >= 2.0.0 - X-Build-Depends-Like: CLibName + Build-Depends: + -- See Note [GHC Boot libraries] + base + , containers + , directory + , filepath + , mtl + , process + , transformers + + , fclabels < 2.1 && >= 2.0 + , hspec < 2.4 && >= 2.0.0 + , monad-journal < 0.8 && >= 0.4 + , split < 0.3 && >= 0.2.2 + , temporary < 1.3 && >= 1.2.0.3 + + + , cabal-helper < 0.8 && >= 0.7.1.0 + , ghc < 8.2 && >= 7.6 + , ghc-mod Benchmark criterion Type: exitcode-stdio-1.0 @@ -318,24 +347,22 @@ Benchmark criterion DataKinds, KindSignatures, TypeOperators, ViewPatterns HS-Source-Dirs: bench, test Main-Is: Bench.hs - Build-Depends: base - , directory < 1.3 - , filepath < 1.5 - , process < 1.5 - , split < 0.3 - , mtl < 2.3 && >= 2.0 - , ghc < 8.1 - - , monad-journal < 0.8 && >= 0.4 - , fclabels == 2.0.* - , temporary < 1.3 + Build-Depends: + -- See Note [GHC Boot libraries] + base + , directory + , filepath - , hspec >= 2.0.0 - - , criterion + , criterion < 1.2 && >= 1.1.1.0 + , temporary < 1.3 && >= 1.2.0.3 , ghc-mod Source-Repository head Type: git Location: https://github.com/DanielG/ghc-mod.git + +-- Note [GHC Boot libraries] +-- +-- We don't give bounds to GHC boot libraries as our dependency on 'ghc' already +-- constrains these packages to the version that shipped with GHC \ No newline at end of file