[commit: haddock] ghc-head, ghc-head1, headdock-library-1.4.5, ie_avails, master, pr/cabal-desc, v2.18, wip/T14529, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13, wip/ttg6-unrevert-2017-11-22: Refactor .cabal to use sub-lib for vendored lib (3bf3d4c)

git at git.haskell.org git at git.haskell.org
Tue Nov 28 11:53:11 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branches: ghc-head,ghc-head1,headdock-library-1.4.5,ie_avails,master,pr/cabal-desc,v2.18,wip/T14529,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13,wip/ttg6-unrevert-2017-11-22
Link       : http://git.haskell.org/haddock.git/commitdiff/3bf3d4c95c3b32ff350e127ee087c85d5bbb24c6

>---------------------------------------------------------------

commit 3bf3d4c95c3b32ff350e127ee087c85d5bbb24c6
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Thu Jul 20 10:02:06 2017 +0200

    Refactor .cabal to use sub-lib for vendored lib
    
    A practical benefit is that we can control the build-depends and also
    avoid some recompilation between library and test-suite.


>---------------------------------------------------------------

3bf3d4c95c3b32ff350e127ee087c85d5bbb24c6
 haddock-library/haddock-library.cabal | 63 +++++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 21 deletions(-)

diff --git a/haddock-library/haddock-library.cabal b/haddock-library/haddock-library.cabal
index c5ad456..004011a 100644
--- a/haddock-library/haddock-library.cabal
+++ b/haddock-library/haddock-library.cabal
@@ -24,9 +24,11 @@ library
       base         >= 4.5     && < 4.11
     , bytestring   >= 0.9.2.1 && < 0.11
     , transformers >= 0.3.0   && < 0.6
-    , deepseq      >= 1.3     && < 1.5
 
-  hs-source-dirs:       src, vendor/attoparsec-0.13.1.0
+  -- internal sub-lib
+  build-depends:        attoparsec
+
+  hs-source-dirs:       src
   ghc-options:          -funbox-strict-fields -Wall -fwarn-tabs -O2
 
   exposed-modules:
@@ -37,10 +39,31 @@ library
     Documentation.Haddock.Utf8
 
   other-modules:
-    Data.Attoparsec
+    Documentation.Haddock.Parser.Util
+
+  ghc-options: -Wall
+  if impl(ghc >= 8.0)
+    ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
+
+library attoparsec
+  default-language:     Haskell2010
+
+  build-depends:
+      base         >= 4.5     && < 4.11
+    , bytestring   >= 0.9.2.1 && < 0.11
+    , deepseq      >= 1.3     && < 1.5
+
+  hs-source-dirs:       vendor/attoparsec-0.13.1.0
+
+  -- NB: haddock-library needs only small part of lib:attoparsec
+  --     internally, so we only bundle that subset here
+  exposed-modules:
     Data.Attoparsec.ByteString
-    Data.Attoparsec.ByteString.Buffer
     Data.Attoparsec.ByteString.Char8
+
+  other-modules:
+    Data.Attoparsec
+    Data.Attoparsec.ByteString.Buffer
     Data.Attoparsec.ByteString.FastSet
     Data.Attoparsec.ByteString.Internal
     Data.Attoparsec.Combinator
@@ -48,7 +71,8 @@ library
     Data.Attoparsec.Internal.Fhthagn
     Data.Attoparsec.Internal.Types
     Data.Attoparsec.Number
-    Documentation.Haddock.Parser.Util
+
+  ghc-options:          -funbox-strict-fields -Wall -fwarn-tabs -O2
 
   ghc-options: -Wall
   if impl(ghc >= 8.0)
@@ -56,6 +80,7 @@ library
   else
     build-depends: semigroups ^>= 0.18.3, fail ^>= 4.9.0.0
 
+
 test-suite spec
   type:             exitcode-stdio-1.0
   default-language: Haskell2010
@@ -63,22 +88,12 @@ test-suite spec
   hs-source-dirs:
       test
     , src
-    , vendor/attoparsec-0.13.1.0
   ghc-options: -Wall
 
   cpp-options:
       -DTEST
 
   other-modules:
-      Data.Attoparsec.ByteString
-      Data.Attoparsec.ByteString.Buffer
-      Data.Attoparsec.ByteString.Char8
-      Data.Attoparsec.ByteString.FastSet
-      Data.Attoparsec.ByteString.Internal
-      Data.Attoparsec.Combinator
-      Data.Attoparsec.Internal
-      Data.Attoparsec.Internal.Fhthagn
-      Data.Attoparsec.Internal.Types
       Documentation.Haddock.Doc
       Documentation.Haddock.Parser
       Documentation.Haddock.Parser.Monad
@@ -90,17 +105,23 @@ test-suite spec
       Documentation.Haddock.Utf8Spec
 
   build-depends:
+      base-compat   ^>= 0.9.3
+    , transformers   >= 0.3.0   && < 0.6
+    , hspec         ^>= 2.4.4
+    , QuickCheck    ^>= 2.10
+
+  -- internal sub-lib
+  build-depends: attoparsec
+
+  -- Versions for the dependencies below are transitively pinned by
+  -- dependency on haddock-library:lib:attoparsec
+  build-depends:
       base
     , bytestring
-    , transformers
     , deepseq
 
-    , base-compat
-    , hspec
-    , QuickCheck == 2.*
-
   build-tool-depends:
-    hspec-discover:hspec-discover
+    hspec-discover:hspec-discover ^>= 2.4.4
 
 source-repository head
   type:     git



More information about the ghc-commits mailing list