Commit b1d9b148 authored by Saizan's avatar Saizan
Browse files

Fix #396 and add let .Haddock find autogen modules

parent 89798963
......@@ -135,7 +135,7 @@ haddock pkg_descr lbi suffixes flags = do
createDirectoryIfMissingVerbose verbosity True tmpDir
createDirectoryIfMissingVerbose verbosity True $
haddockPref distPref pkg_descr
preprocessSources pkg_descr lbi False verbosity suffixes
initialBuildSteps distPref pkg_descr lbi verbosity suffixes
setupMessage verbosity "Running Haddock for" (packageId pkg_descr)
......@@ -196,9 +196,6 @@ haddock pkg_descr lbi suffixes flags = do
then ("-B" ++ ghcLibDir) : map ("--optghc=" ++) (ghcSimpleOptions lbi bi preprocessDir)
else []
when isVersion2 $
initialBuildSteps distPref pkg_descr lbi verbosity suffixes
withLib pkg_descr () $ \lib -> do
let bi = libBuildInfo lib
modules = PD.exposedModules lib ++ otherModules bi
......@@ -419,7 +416,7 @@ hscolour pkg_descr lbi suffixes flags = do
getLibSourceFiles :: LocalBuildInfo -> Library -> IO [FilePath]
getLibSourceFiles lbi lib = sequence
[ findFileWithExtension ["hs", "lhs"] (preprocessDir : hsSourceDirs bi)
[ findFileWithExtension ["hs", "lhs"] (autogenModulesDir lbi: preprocessDir : hsSourceDirs bi)
(ModuleName.toFilePath module_) >>= maybe (notFound module_) (return . normalise)
| module_ <- modules ]
where
......@@ -432,7 +429,7 @@ getExeSourceFiles :: LocalBuildInfo -> Executable -> IO [FilePath]
getExeSourceFiles lbi exe = do
srcMainPath <- findFile (hsSourceDirs bi) (modulePath exe)
moduleFiles <- sequence
[ findFileWithExtension ["hs", "lhs"] (preprocessDir : hsSourceDirs bi)
[ findFileWithExtension ["hs", "lhs"] (autogenModulesDir lbi : preprocessDir : hsSourceDirs bi)
(ModuleName.toFilePath module_) >>= maybe (notFound module_) (return . normalise)
| module_ <- modules ]
return (srcMainPath : moduleFiles)
......
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