Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Cleanup ghc-mod.cabal
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
DanielG committed Dec 23, 2016
1 parent dbf9933 commit ba281ba
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 120 deletions.
47 changes: 0 additions & 47 deletions Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 ()
Expand Down
3 changes: 2 additions & 1 deletion bench/Bench.hs
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
171 changes: 99 additions & 72 deletions ghc-mod.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -277,15 +288,15 @@ 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
Default-Extensions: ScopedTypeVariables, RecordWildCards, NamedFieldPuns,
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
Expand All @@ -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
Expand All @@ -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

0 comments on commit ba281ba

Please sign in to comment.