Skip to content

Commit

Permalink
priv deps: Test long bad closure
Browse files Browse the repository at this point in the history
This test makes a long chain of packages violate the private closure
property. In particular, it ensures all of the packages that are missing
from the private scope are listed in the error message.
  • Loading branch information
alt-romes committed Apr 30, 2024
1 parent 638a26b commit 894c6c3
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: libA, libB, libC, libD, libE, libH
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Test.Cabal.Prelude

main = do
cabalTest $ recordMode DoNotRecord $ do

-- Will violate closure property
fails (cabal' "v2-build" ["libA"])
>>= assertOutputContains "a private scope must contain its closure, but packages libC, libD, libE are not included in the private scope libA:P0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cabal-version: 3.0
name: libA
version: 0.1.0.0
license: NONE
build-type: Simple

library
exposed-modules: MyLib
build-depends: base
private-build-depends: P0 with (libB, libH)
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cabal-version: 3.0
name: libB
version: 0.1.0.0
license: NONE
build-type: Simple

library
exposed-modules: MyLib
build-depends: base, libC
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cabal-version: 3.0
name: libC
version: 0.1.0.0
license: NONE
build-type: Simple

library
exposed-modules: MyLib
build-depends: base, libD
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cabal-version: 3.0
name: libD
version: 0.1.0.0
license: NONE
build-type: Simple

library
exposed-modules: MyLib
build-depends: base, libE
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cabal-version: 3.0
name: libE
version: 0.1.0.0
license: NONE
build-type: Simple

library
exposed-modules: MyLib
build-depends: base, libH
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cabal-version: 3.0
name: libH
version: 0.1.0.0
license: NONE
build-type: Simple

library
exposed-modules: MyLib
build-depends: base
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"

0 comments on commit 894c6c3

Please sign in to comment.