Commit 8814b950 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Change UserHooks.readDesc to use GenericPackageDescription

Also changes Simple.defaultMainNoRead to use GenericPackageDescription.
This is an API change that in principle could break Setup.hs scripts
but in practise there are no Setup.hs scripts that use either.
parent af1d3b1d
......@@ -148,7 +148,7 @@ defaultMainWithHooksArgs = defaultMainHelper
-- | Like 'defaultMain', but accepts the package description as input
-- rather than using IO to read it.
defaultMainNoRead :: PackageDescription -> IO ()
defaultMainNoRead :: GenericPackageDescription -> IO ()
defaultMainNoRead pkg_descr =
getArgs >>=
defaultMainHelper simpleUserHooks { readDesc = return (Just pkg_descr) }
......@@ -212,7 +212,7 @@ configureAction hooks flags args = do
-- get_pkg_descr (configVerbosity flags')
--let pkg_descr = updatePackageDescription pbi pkg_descr0
let epkg_descr = (pkg_descr0, pbi)
let epkg_descr = (Left pkg_descr0, pbi)
--(warns, ers) <- sanityCheckPackage pkg_descr
--errorOut (configVerbosity flags') warns ers
......@@ -227,17 +227,15 @@ configureAction hooks flags args = do
postConf hooks args flags pkg_descr localbuildinfo
where
verbosity = fromFlag (configVerbosity flags)
confPkgDescr :: IO (Maybe FilePath,
Either GenericPackageDescription
PackageDescription)
confPkgDescr :: IO (Maybe FilePath, GenericPackageDescription)
confPkgDescr = do
mdescr <- readDesc hooks
case mdescr of
Just descr -> return (Nothing, Right descr)
Just descr -> return (Nothing, descr)
Nothing -> do
pdfile <- defaultPackageDesc verbosity
ppd <- readPackageDescription verbosity pdfile
return (Just pdfile, Left ppd)
descr <- readPackageDescription verbosity pdfile
return (Just pdfile, descr)
buildAction :: UserHooks -> BuildFlags -> Args -> IO ()
buildAction hooks flags args = do
......
......@@ -82,7 +82,7 @@ data UserHooks = UserHooks {
-- | Used for @.\/setup test@
runTests :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO (),
-- | Read the description file
readDesc :: IO (Maybe PackageDescription),
readDesc :: IO (Maybe GenericPackageDescription),
-- | Custom preprocessors in addition to and overriding 'knownSuffixHandlers'.
hookedPreProcessors :: [ PPSuffixHandler ],
-- | These programs are detected at configure time. Arguments for them are
......
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