Commit 69a7eb91 authored by Moritz Angermann's avatar Moritz Angermann
Browse files

Revert "Adds doctest-ghc(js)-options:"; drop --ghc-options from --help

parent 1915a903
......@@ -78,7 +78,6 @@ module Distribution.PackageDescription (
allExtensions,
usedExtensions,
hcOptions,
hcDoctestOptions,
hcProfOptions,
hcSharedOptions,
......
......@@ -520,11 +520,6 @@ binfoFieldDescrs =
options (const id)
, optsField "nhc98-options" NHC
options (const id)
, optsField "doctest-ghc-options" GHC
doctestOptions (\path binfo -> binfo{doctestOptions=path})
, optsField "doctest-ghcjs-options" GHCJS
doctestOptions (\path binfo -> binfo{doctestOptions=path})
]
storeXFieldsBI :: UnrecFieldParser BuildInfo
......
......@@ -524,11 +524,6 @@ binfoFieldDescrs =
options (const id)
, optsField "nhc98-options" NHC
options (const id)
, optsField "doctest-ghc-options" GHC
doctestOptions (\path binfo -> binfo{doctestOptions=path})
, optsField "doctest-ghcjs-options" GHCJS
doctestOptions (\path binfo -> binfo{doctestOptions=path})
]
{-
......
......@@ -70,10 +70,6 @@ doctest pkg_descr lbi suffixes doctestFlags = do
withAllComponentsInBuildOrder pkg_descr lbi $ \component clbi -> do
componentInitialBuildSteps (flag doctestDistPref) pkg_descr lbi clbi verbosity
preprocessComponent pkg_descr component lbi clbi False verbosity suffixes
-- let
-- smsg :: IO ()
-- smsg = setupMessage' verbosity "Running Doctest on" (packageId pkg_descr)
-- (componentLocalName clbi) (maybeComponentInstantiatedWith clbi)
case component of
CLib lib -> do
......@@ -108,18 +104,6 @@ componentGhcOptions verbosity lbi bi clbi odir =
"doctest only supports GHC and GHCJS"
in f verbosity lbi bi clbi odir
-- componentDoctestGhcOptions :: Verbosity -> LocalBuildInfo
-- -> BuildInfo -> ComponentLocalBuildInfo -> FilePath
-- -> GhcOptions
-- componentDoctestGhcOptions verbosity lbi bi clbi odir =
-- let f = case compilerFlavor (compiler lbi) of
-- GHC -> GHC.componentDoctestGhcOptions
-- GHCJS -> GHCJS.componentDoctestGhcOptions
-- _ -> error $
-- "Distribution.Simple.Doctest.componentDoctestGhcOptions:" ++
-- "doctest only support GHC and GHCJS"
-- in f verbosity lbi bi clbi odir
mkDoctestArgs :: Verbosity
-> FilePath
-> LocalBuildInfo
......@@ -129,7 +113,8 @@ mkDoctestArgs :: Verbosity
-> IO DoctestArgs
mkDoctestArgs verbosity tmp lbi clbi inFiles bi = do
let vanillaOpts = (componentGhcOptions normal lbi bi clbi (buildDir lbi))
{ ghcOptOptimisation = mempty
{ ghcOptOptimisation = mempty -- no optimizations when runnign doctest
-- disable -Wmissing-home-modules
, ghcOptWarnMissingHomeModules = mempty
-- clear out ghc-options: these are likely not meant for doctest.
-- If so, should be explicitly specified via doctest-ghc-options: again.
......@@ -154,7 +139,6 @@ mkDoctestArgs verbosity tmp lbi clbi inFiles bi = do
ghcVersion <- maybe (die' verbosity "Compiler has no GHC version")
return
(compilerCompatVersion GHC (compiler lbi))
return $ DoctestArgs
{ argTargets = inFiles
, argGhcOptions = toFlag (opts, ghcVersion)
......@@ -188,8 +172,7 @@ renderArgs _verbosity comp platform args k = do
[ pure "--no-magic" -- disable doctests automagic discovery heuristics
, pure "-fdiagnostics-color=never" -- disable ghc's color diagnostics.
, [ opt | (opts, _ghcVer) <- flagToList (argGhcOptions args)
, opt <- renderGhcOptions comp platform opts
<> fromNubListR (ghcOptDoctest opts) ]
, opt <- renderGhcOptions comp platform opts ]
]
-- ------------------------------------------------------------------------------
......
......@@ -344,7 +344,6 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir =
ghcOptOptimisation = toGhcOptimisation (withOptimization lbi),
ghcOptDebugInfo = toGhcDebugInfo (withDebugInfo lbi),
ghcOptExtra = toNubListR $ hcOptions GHC bi,
ghcOptDoctest = toNubListR $ hcDoctestOptions GHC bi,
ghcOptExtraPath = toNubListR $ exe_paths,
ghcOptLanguage = toFlag (fromMaybe Haskell98 (defaultLanguage bi)),
-- Unsupported extensions have already been checked by configure
......
......@@ -47,10 +47,6 @@ data GhcOptions = GhcOptions {
-- override other stuff.
ghcOptExtra :: NubListR String,
-- | Any options to pass to ghc through doctest. These go at the end and hence
-- override other stuff. Note: cabal doctest will ignore @ghcOptExtra@.
ghcOptDoctest :: NubListR String,
-- | Extra default flags to pass directly to ghc. These go at the beginning
-- and so can be overridden by other stuff.
ghcOptExtraDefault :: NubListR String,
......
......@@ -1419,7 +1419,7 @@ doctestCommand = CommandUI
"Usage: " ++ pname ++ " doctest [FLAGS]\n"
, commandDefaultFlags = defaultDoctestFlags
, commandOptions = \showOrParseArgs ->
doctestCmdOptions showOrParseArgs
doctestOptions showOrParseArgs
++ programDbPaths progDb ParseArgs
doctestProgramPaths (\v flags -> flags { doctestProgramPaths = v })
++ programDbOption progDb showOrParseArgs
......@@ -1429,11 +1429,10 @@ doctestCommand = CommandUI
}
where
progDb = addKnownProgram doctestProgram
$ addKnownProgram ghcProgram
$ emptyProgramDb
emptyProgramDb
doctestCmdOptions :: ShowOrParseArgs -> [OptionField DoctestFlags]
doctestCmdOptions showOrParseArgs =
doctestOptions :: ShowOrParseArgs -> [OptionField DoctestFlags]
doctestOptions showOrParseArgs =
[optionVerbosity doctestVerbosity
(\v flags -> flags { doctestVerbosity = v })
,optionDistPref
......
......@@ -10,7 +10,6 @@ module Distribution.Types.BuildInfo (
usedExtensions,
hcOptions,
hcDoctestOptions,
hcProfOptions,
hcSharedOptions,
) where
......@@ -75,7 +74,6 @@ data BuildInfo = BuildInfo {
options :: [(CompilerFlavor,[String])],
profOptions :: [(CompilerFlavor,[String])],
sharedOptions :: [(CompilerFlavor,[String])],
doctestOptions :: [(CompilerFlavor,[String])],
customFieldsBI :: [(String,String)], -- ^Custom fields starting
-- with x-, stored in a
-- simple assoc-list.
......@@ -114,7 +112,6 @@ instance Monoid BuildInfo where
includes = [],
installIncludes = [],
options = [],
doctestOptions = [],
profOptions = [],
sharedOptions = [],
customFieldsBI = [],
......@@ -151,7 +148,6 @@ instance Semigroup BuildInfo where
includes = combineNub includes,
installIncludes = combineNub installIncludes,
options = combine options,
doctestOptions = combine doctestOptions,
profOptions = combine profOptions,
sharedOptions = combine sharedOptions,
customFieldsBI = combine customFieldsBI,
......@@ -188,9 +184,6 @@ usedExtensions bi = oldExtensions bi
hcOptions :: CompilerFlavor -> BuildInfo -> [String]
hcOptions = lookupHcOptions options
hcDoctestOptions :: CompilerFlavor -> BuildInfo -> [String]
hcDoctestOptions = lookupHcOptions doctestOptions
hcProfOptions :: CompilerFlavor -> BuildInfo -> [String]
hcProfOptions = lookupHcOptions profOptions
......
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