Skip to content

mkComponentGraph is broken #6894

Closed
Closed
@phadej

Description

@phadej
-- | Create a 'Graph' of 'Component', or report a cycle if there is a
-- problem.
--
mkComponentsGraph :: ComponentRequestedSpec
                  -> PackageDescription
                  -> Either [ComponentName] ComponentsGraph
mkComponentsGraph enabled pkg_descr =
    let g = Graph.fromDistinctList
                           [ N c (componentName c) (componentDeps c)
                           | c <- pkgBuildableComponents pkg_descr
                           , componentEnabled enabled c ]
    in case Graph.cycles g of
          []     -> Right g
          ccycles -> Left  [ componentName c | N c _ _ <- concat ccycles ]
  where
    -- The dependencies for the given component
    componentDeps component =
      (CExeName <$> getAllInternalToolDependencies pkg_descr bi)

      ++ [ if pkgname == packageName pkg_descr
           then CLibName LMainLibName
           else CLibName (LSubLibName toolname)
         | Dependency pkgname _ _ <- targetBuildDepends bi
           -- ^ HERE, we ignore the library names all together
         , let toolname = packageNameToUnqualComponentName pkgname
         , toolname `elem` internalPkgDeps ]
      where

I think that because of this issue the foo:bar syntax is broken beyond repair in Cabal-3.0 and 3.2.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions