Commit e1b6c568 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Fix Haddock documentation.

Fix #98.
parent 7122295a
......@@ -8,6 +8,9 @@ import Rules.Actions
import Rules.Resources
import Settings
haddockHtmlLib :: FilePath
haddockHtmlLib = "inplace/lib/html/haddock-util.js"
-- Note: this build rule creates plenty of files, not just the .haddock one.
-- All of them go into the 'doc' subdirectory. Pedantically tracking all built
-- files in the Shake databases seems fragile and unnecesarry.
......@@ -22,9 +25,10 @@ buildPackageDocumentation _ target @ (PartialTarget stage pkg) =
let haddocks = [ pkgHaddockFile depPkg
| Just depPkg <- map findKnownPackage deps
, depPkg /= rts ]
need $ srcs ++ haddocks
need $ srcs ++ haddocks ++ [haddockHtmlLib]
-- HsColour sources
-- TODO: what is the output of GhcCabalHsColour?
whenM (specified HsColour) $ do
pkgConf <- pkgConfFile stage pkg
need [ cabalFile, pkgConf ] -- TODO: check if need pkgConf
......@@ -34,6 +38,11 @@ buildPackageDocumentation _ target @ (PartialTarget stage pkg) =
let haddockWay = if dynamicGhcPrograms then dynamic else vanilla
build $ fullTargetWithWay target Haddock haddockWay srcs [file]
when (pkg == haddock) $ haddockHtmlLib %> \_ -> do
let dir = takeDirectory haddockHtmlLib
liftIO $ removeFiles dir ["//*"]
copyDirectory "utils/haddock/haddock-api/resources/html" dir
-- # Make the haddocking depend on the library .a file, to ensure
-- # that we wait until the library is fully built before we haddock it
-- $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$($1_$2_$$(HADDOCK_WAY)_LIB)
......
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