Commit f75c6b15 authored by Moritz Angermann's avatar Moritz Angermann
Browse files

Fix -package-db for inplace package dbs; require doctest 0.11.3 and up.

The inplace package-db was not passed by default, as I had initially assumed.
We also no encode the requirement for doctest 0.11.3, which sports the
--no-magic flag.
parent 69a7eb91
......@@ -296,16 +296,17 @@ doctestAction :: UserHooks -> DoctestFlags -> Args -> IO ()
doctestAction hooks flags args = do
distPref <- findDistPrefOrDefault (doctestDistPref flags)
let verbosity = fromFlag $ doctestVerbosity flags
flags' = flags { doctestDistPref = toFlag distPref }
lbi <- getBuildConfig hooks verbosity distPref
progs <- reconfigurePrograms verbosity
(doctestProgramPaths flags)
(doctestProgramArgs flags)
(doctestProgramPaths flags')
(doctestProgramArgs flags')
(withPrograms lbi)
hookedAction preDoctest doctestHook postDoctest
(return lbi { withPrograms = progs })
hooks flags args
hooks flags' args
haddockAction :: UserHooks -> HaddockFlags -> Args -> IO ()
haddockAction hooks flags args = do
......
......@@ -33,6 +33,7 @@ import Distribution.Simple.PreProcess
import Distribution.Simple.Setup
import Distribution.Simple.Build
import Distribution.Simple.LocalBuildInfo hiding (substPathTemplate)
import Distribution.Simple.Register (internalPackageDBPath)
import Distribution.Simple.BuildPaths
import Distribution.Simple.Utils
import Distribution.System
......@@ -60,15 +61,18 @@ doctest :: PackageDescription
-> IO ()
doctest pkg_descr lbi suffixes doctestFlags = do
let verbosity = flag doctestVerbosity
distPref = flag doctestDistPref
flag f = fromFlag $ f doctestFlags
tmpFileOpts = defaultTempFileOptions
lbi' = lbi { withPackageDB = withPackageDB lbi
++ [SpecificPackageDB (internalPackageDBPath lbi distPref)] }
(doctestProg, _version, _) <-
requireProgramVersion verbosity doctestProgram
(orLaterVersion (mkVersion [0,11])) (withPrograms lbi)
(orLaterVersion (mkVersion [0,11,3])) (withPrograms lbi)
withAllComponentsInBuildOrder pkg_descr lbi $ \component clbi -> do
componentInitialBuildSteps (flag doctestDistPref) pkg_descr lbi clbi verbosity
componentInitialBuildSteps distPref pkg_descr lbi clbi verbosity
preprocessComponent pkg_descr component lbi clbi False verbosity suffixes
case component of
......@@ -76,19 +80,18 @@ doctest pkg_descr lbi suffixes doctestFlags = do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
inFiles <- map snd <$> getLibSourceFiles verbosity lbi lib clbi
args <- mkDoctestArgs verbosity tmp lbi clbi inFiles (libBuildInfo lib)
args <- mkDoctestArgs verbosity tmp lbi' clbi inFiles (libBuildInfo lib)
runDoctest verbosity (compiler lbi) (hostPlatform lbi) doctestProg args
CExe exe -> do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
inFiles <- map snd <$> getExeSourceFiles verbosity lbi exe clbi
args <- mkDoctestArgs verbosity tmp lbi clbi inFiles (buildInfo exe)
args <- mkDoctestArgs verbosity tmp lbi' clbi inFiles (buildInfo exe)
runDoctest verbosity (compiler lbi) (hostPlatform lbi) doctestProg args
CFLib _ -> return () -- do not doctest foreign libs
CTest _ -> return () -- do not doctest tests
CBench _ -> return () -- do not doctest benchmarks
-- -----------------------------------------------------------------------------
-- Contributions to DoctestArgs (see also Haddock.hs for very similar code).
......
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