Skip to content

Commit e9a20c8

Browse files
committed
Add a reproducer for #6894
1 parent 14010da commit e9a20c8

File tree

11 files changed

+48
-6
lines changed

11 files changed

+48
-6
lines changed

Cabal/Distribution/Backpack/ComponentsGraph.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ componentsGraphToList =
8989
map (\(N c _ cs) -> (c, cs)) . Graph.revTopSort
9090

9191
-- | Error message when there is a cycle; takes the SCC of components.
92-
componentCycleMsg :: [ComponentName] -> Doc
93-
componentCycleMsg cnames =
94-
text $ "Components in the package depend on each other in a cyclic way:\n "
95-
++ intercalate " depends on "
92+
componentCycleMsg :: PackageIdentifier -> [ComponentName] -> Doc
93+
componentCycleMsg pn cnames =
94+
text "Components in the package" <+> pretty pn <+> text "depend on each other in a cyclic way:"
95+
$$
96+
text (intercalate " depends on "
9697
[ "'" ++ showComponentName cname ++ "'"
97-
| cname <- cnames ++ maybeToList (safeHead cnames) ]
98+
| cname <- cnames ++ maybeToList (safeHead cnames) ])

Cabal/Distribution/Backpack/Configure.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ configureComponentLocalBuildInfos
7878
-- NB: In single component mode, this returns a *single* component.
7979
-- In this graph, the graph is NOT closed.
8080
graph0 <- case mkComponentsGraph enabled pkg_descr of
81-
Left ccycle -> dieProgress (componentCycleMsg ccycle)
81+
Left ccycle -> dieProgress (componentCycleMsg (package pkg_descr) ccycle)
8282
Right g -> return (componentsGraphToList g)
8383
infoProgress $ hang (text "Source component graph:") 4
8484
(dispComponentsWithDeps graph0)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Bar where
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Foo where
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# cabal v2-build
2+
Resolving dependencies...
3+
Error:
4+
Dependency cycle between the following components: library
5+
In the inplace package 'issue-6894'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: .
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Test.Cabal.Prelude
2+
main = cabalTest $
3+
fails $ cabal "v2-build" ["issue"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cabal-version: 3.0
2+
name: issue
3+
version: 6894
4+
5+
library
6+
default-language: Haskell2010
7+
build-depends: base, issue:sublib
8+
exposed-modules: Foo
9+
10+
library sublib
11+
default-language: Haskell2010
12+
build-depends: base
13+
exposed-modules: Bar
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Setup configure
2+
Warning: issue.cabal:7:30: colon specifier is experimental feature (issue #5660)
3+
Configuring issue-6894...
4+
Error:
5+
Components in the package issue-6894 depend on each other in a cyclic way:
6+
'library' depends on 'library'
7+
# Setup build
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Setup configure
2+
Warning: issue.cabal:7:30: colon specifier is experimental feature (issue #5660)
3+
Configuring issue-6894...
4+
Error:
5+
Components in the package issue-6894 depend on each other in a cyclic way:
6+
'library' depends on 'library'
7+
# Setup build
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Test.Cabal.Prelude
2+
main = setupAndCabalTest $ do
3+
fails $ setup_build []

0 commit comments

Comments
 (0)