Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Cabal/Distribution/Backpack/ComponentsGraph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ componentsGraphToList =
map (\(N c _ cs) -> (c, cs)) . Graph.revTopSort

-- | Error message when there is a cycle; takes the SCC of components.
componentCycleMsg :: [ComponentName] -> Doc
componentCycleMsg cnames =
text $ "Components in the package depend on each other in a cyclic way:\n "
++ intercalate " depends on "
componentCycleMsg :: PackageIdentifier -> [ComponentName] -> Doc
componentCycleMsg pn cnames =
text "Components in the package" <+> pretty pn <+> text "depend on each other in a cyclic way:"
$$
text (intercalate " depends on "
[ "'" ++ showComponentName cname ++ "'"
| cname <- cnames ++ maybeToList (safeHead cnames) ]
| cname <- cnames ++ maybeToList (safeHead cnames) ])
2 changes: 1 addition & 1 deletion Cabal/Distribution/Backpack/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ configureComponentLocalBuildInfos
-- NB: In single component mode, this returns a *single* component.
-- In this graph, the graph is NOT closed.
graph0 <- case mkComponentsGraph enabled pkg_descr of
Left ccycle -> dieProgress (componentCycleMsg ccycle)
Left ccycle -> dieProgress (componentCycleMsg (package pkg_descr) ccycle)
Right g -> return (componentsGraphToList g)
infoProgress $ hang (text "Source component graph:") 4
(dispComponentsWithDeps graph0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Setup configure
Configuring DepCycle-1.0...
Error:
Components in the package depend on each other in a cyclic way:
'library 'bar'' depends on 'library 'foo'' depends on 'library 'bar''
Components in the package DepCycle-1.0 depend on each other in a cyclic way:
'library 'bar'' depends on 'library 'foo'' depends on 'library 'bar''
4 changes: 2 additions & 2 deletions cabal-testsuite/PackageTests/BuildDeps/DepCycle/setup.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Setup configure
Configuring DepCycle-1.0...
Error:
Components in the package depend on each other in a cyclic way:
'library 'bar'' depends on 'library 'foo'' depends on 'library 'bar''
Components in the package DepCycle-1.0 depend on each other in a cyclic way:
'library 'bar'' depends on 'library 'foo'' depends on 'library 'bar''
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Bar where
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Foo where
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# cabal v2-build
Resolving dependencies...
Error:
Dependency cycle between the following components: library
In the inplace package 'issue-6894'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: .
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Test.Cabal.Prelude
main = cabalTest $
fails $ cabal "v2-build" ["issue"]
13 changes: 13 additions & 0 deletions cabal-testsuite/PackageTests/MultipleLibraries/T6894/issue.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0
name: issue
version: 6894

library
default-language: Haskell2010
build-depends: base, issue:sublib
exposed-modules: Foo

library sublib
default-language: Haskell2010
build-depends: base
exposed-modules: Bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Setup configure
Warning: issue.cabal:7:30: colon specifier is experimental feature (issue #5660)
Configuring issue-6894...
Error:
Components in the package issue-6894 depend on each other in a cyclic way:
'library' depends on 'library'
# Setup build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Setup configure
Warning: issue.cabal:7:30: colon specifier is experimental feature (issue #5660)
Configuring issue-6894...
Error:
Components in the package issue-6894 depend on each other in a cyclic way:
'library' depends on 'library'
# Setup build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Test.Cabal.Prelude
main = setupAndCabalTest $ do
fails $ setup_build []