aboutsummaryrefslogtreecommitdiff
path: root/haddock-test/src
diff options
context:
space:
mode:
authorAlexander Biehl <alexbiehl@gmail.com>2018-06-14 15:28:52 +0200
committerGitHub <noreply@github.com>2018-06-14 15:28:52 +0200
commit6247ec8b5a5bc8145ce851dce11eb617a380381c (patch)
tree7856c0dd1ddd0c1f3eef0422b0cd8e8a5a6b71cb /haddock-test/src
parent9a7f539d0c20654ff394f2ff99836412a6844df1 (diff)
parent095fa970b32c818ed4c06cefc00ba98aaff756fa (diff)
Merge pull request #857 from sjakobi/ghc-head-update-3
Update ghc-head
Diffstat (limited to 'haddock-test/src')
-rw-r--r--haddock-test/src/Test/Haddock/Config.hs25
1 files changed, 21 insertions, 4 deletions
diff --git a/haddock-test/src/Test/Haddock/Config.hs b/haddock-test/src/Test/Haddock/Config.hs
index 988636e4..8b395b6c 100644
--- a/haddock-test/src/Test/Haddock/Config.hs
+++ b/haddock-test/src/Test/Haddock/Config.hs
@@ -98,6 +98,7 @@ data Flag
= FlagHaddockPath FilePath
| FlagHaddockOptions String
| FlagHaddockStdOut FilePath
+ | FlagGhcPath FilePath
| FlagDiffTool FilePath
| FlagNoDiff
| FlagAccept
@@ -108,6 +109,8 @@ data Flag
flagsHaddockPath :: [Flag] -> Maybe FilePath
flagsHaddockPath flags = mlast [ path | FlagHaddockPath path <- flags ]
+flagsGhcPath :: [Flag] -> Maybe FilePath
+flagsGhcPath flags = mlast [ path | FlagGhcPath path <- flags ]
flagsHaddockOptions :: [Flag] -> [String]
flagsHaddockOptions flags = concat
@@ -130,6 +133,8 @@ options =
"additional options to run Haddock with"
, Option [] ["haddock-stdout"] (ReqArg FlagHaddockStdOut "FILE")
"where to redirect Haddock output"
+ , Option [] ["ghc-path"] (ReqArg FlagGhcPath "FILE")
+ "path ghc executable"
, Option [] ["diff-tool"] (ReqArg FlagDiffTool "PATH")
"diff tool to use when printing failed cases"
, Option ['a'] ["accept"] (NoArg FlagAccept)
@@ -178,8 +183,11 @@ loadConfig ccfg dcfg flags files = do
hPutStrLn stderr "Haddock executable not found"
exitFailure
- ghcPath <- init <$> rawSystemStdout normal cfgHaddockPath
- ["--print-ghc-path"]
+ ghcPath <- case flagsGhcPath flags of
+ Just fp -> return fp
+ Nothing -> init <$> rawSystemStdout normal
+ cfgHaddockPath
+ ["--print-ghc-path"]
printVersions cfgEnv cfgHaddockPath
@@ -189,6 +197,7 @@ loadConfig ccfg dcfg flags files = do
[ pure ["--no-warnings"]
, pure ["--odir=" ++ dcfgOutDir dcfg]
, pure ["--optghc=-w"]
+ , pure ["--optghc=-hide-all-packages"]
, pure $ flagsHaddockOptions flags
, baseDependencies ghcPath
]
@@ -236,13 +245,21 @@ baseDependencies ghcPath = do
#else
pkgIndex <- getInstalledPackages normal [GlobalPackageDB] cfg
#endif
- mapM (getDependency pkgIndex) ["base", "process", "ghc-prim"]
+ let
+ pkgs =
+ [ "array"
+ , "base"
+ , "ghc-prim"
+ , "process"
+ , "template-haskell"
+ ]
+ concat `fmap` mapM (getDependency pkgIndex) pkgs
where
getDependency pkgIndex name = case ifaces pkgIndex name of
[] -> do
hPutStrLn stderr $ "Couldn't find base test dependency: " ++ name
exitFailure
- (ifArg:_) -> pure ifArg
+ (ifArg:_) -> pure ["--optghc=-package" ++ name, ifArg]
ifaces pkgIndex name = do
pkg <- join $ snd <$> lookupPackageName pkgIndex (mkPackageName name)
iface <$> haddockInterfaces pkg <*> haddockHTMLs pkg