Commit 0d6cc119 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Fix cabal haddock for packages with internal dependencies

parent 65e22158
...@@ -442,8 +442,9 @@ haddockPackageFlags lbi htmlTemplate = do ...@@ -442,8 +442,9 @@ haddockPackageFlags lbi htmlTemplate = do
let allPkgs = installedPkgs lbi let allPkgs = installedPkgs lbi
directDeps = map fst (externalPackageDeps lbi) directDeps = map fst (externalPackageDeps lbi)
transitiveDeps <- case dependencyClosure allPkgs directDeps of transitiveDeps <- case dependencyClosure allPkgs directDeps of
Left x -> return x Left x -> return x
Right _ -> die "Can't find transitive deps for haddock" Right inf -> die $ "internal error when calculating transative "
++ "package dependencies.\nDebug info: " ++ show inf
interfaces <- sequence interfaces <- sequence
[ case interfaceAndHtmlPath ipkg of [ case interfaceAndHtmlPath ipkg of
Nothing -> return (Left (packageId ipkg)) Nothing -> return (Left (packageId ipkg))
......
...@@ -140,13 +140,17 @@ data LocalBuildInfo = LocalBuildInfo { ...@@ -140,13 +140,17 @@ data LocalBuildInfo = LocalBuildInfo {
progSuffix :: PathTemplate -- ^Suffix to be appended to installed executables progSuffix :: PathTemplate -- ^Suffix to be appended to installed executables
} deriving (Read, Show) } deriving (Read, Show)
-- | External package dependencies for the package as a whole, the union of the -- | External package dependencies for the package as a whole. This is the
-- individual 'targetPackageDeps'. -- union of the individual 'componentPackageDeps', less any internal deps.
externalPackageDeps :: LocalBuildInfo -> [(InstalledPackageId, PackageId)] externalPackageDeps :: LocalBuildInfo -> [(InstalledPackageId, PackageId)]
externalPackageDeps lbi = nub $ externalPackageDeps lbi = filter (not . internal . snd) $ nub $
-- TODO: what about non-buildable components? -- TODO: what about non-buildable components?
maybe [] componentPackageDeps (libraryConfig lbi) maybe [] componentPackageDeps (libraryConfig lbi)
++ concatMap (componentPackageDeps . snd) (executableConfigs lbi) ++ concatMap (componentPackageDeps . snd) (executableConfigs lbi)
where
-- True if this dependency is an internal one (depends on the library
-- defined in the same package).
internal pkgid = pkgid == packageId (localPkgDescr lbi)
-- | The installed package Id we use for local packages registered in the local -- | The installed package Id we use for local packages registered in the local
-- package db. This is what is used for intra-package deps between components. -- package db. This is what is used for intra-package deps between components.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment