Commit e14a9c48 authored by Bitrauser's avatar Bitrauser

Add support for `new-haddock --haddock-for-hackage`

parent 5afa3624
......@@ -368,6 +368,7 @@ convertLegacyPerPackageFlags configFlags installFlags haddockFlags =
haddockHtml = packageConfigHaddockHtml,
haddockHtmlLocation = packageConfigHaddockHtmlLocation,
haddockForeignLibs = packageConfigHaddockForeignLibs,
haddockForHackage = packageConfigHaddockForHackage,
haddockExecutables = packageConfigHaddockExecutables,
haddockTestSuites = packageConfigHaddockTestSuites,
haddockBenchmarks = packageConfigHaddockBenchmarks,
......@@ -671,7 +672,7 @@ convertToLegacyPerPackageConfig PackageConfig {..} =
haddockHoogle = packageConfigHaddockHoogle,
haddockHtml = packageConfigHaddockHtml,
haddockHtmlLocation = packageConfigHaddockHtmlLocation,
haddockForHackage = mempty, --TODO: added recently
haddockForHackage = packageConfigHaddockForHackage,
haddockForeignLibs = packageConfigHaddockForeignLibs,
haddockExecutables = packageConfigHaddockExecutables,
haddockTestSuites = packageConfigHaddockTestSuites,
......
......@@ -48,7 +48,7 @@ import Distribution.Simple.Compiler
( Compiler, CompilerFlavor
, OptimisationLevel(..), ProfDetailLevel, DebugInfoLevel(..) )
import Distribution.Simple.Setup
( Flag, AllowNewer(..), AllowOlder(..) )
( Flag, AllowNewer(..), AllowOlder(..), HaddockTarget(..) )
import Distribution.Simple.InstallDirs
( PathTemplate )
import Distribution.Utils.NubList
......@@ -254,6 +254,7 @@ data PackageConfig
packageConfigHaddockHtml :: Flag Bool, --TODO: [required eventually] use this
packageConfigHaddockHtmlLocation :: Flag String, --TODO: [required eventually] use this
packageConfigHaddockForeignLibs :: Flag Bool, --TODO: [required eventually] use this
packageConfigHaddockForHackage :: Flag HaddockTarget,
packageConfigHaddockExecutables :: Flag Bool, --TODO: [required eventually] use this
packageConfigHaddockTestSuites :: Flag Bool, --TODO: [required eventually] use this
packageConfigHaddockBenchmarks :: Flag Bool, --TODO: [required eventually] use this
......@@ -270,6 +271,7 @@ instance Binary ProjectConfigBuildOnly
instance Binary ProjectConfigShared
instance Binary ProjectConfigProvenance
instance Binary PackageConfig
instance Binary HaddockTarget
-- | Newtype wrapper for 'Map' that provides a 'Monoid' instance that takes
......
......@@ -1711,6 +1711,7 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
elabHaddockHtml = perPkgOptionFlag pkgid False packageConfigHaddockHtml
elabHaddockHtmlLocation = perPkgOptionMaybe pkgid packageConfigHaddockHtmlLocation
elabHaddockForeignLibs = perPkgOptionFlag pkgid False packageConfigHaddockForeignLibs
elabHaddockForHackage = perPkgOptionFlag pkgid Cabal.ForDevelopment packageConfigHaddockForHackage
elabHaddockExecutables = perPkgOptionFlag pkgid False packageConfigHaddockExecutables
elabHaddockTestSuites = perPkgOptionFlag pkgid False packageConfigHaddockTestSuites
elabHaddockBenchmarks = perPkgOptionFlag pkgid False packageConfigHaddockBenchmarks
......@@ -3180,7 +3181,8 @@ setupHsHaddockFlags (ElaboratedConfiguredPackage{..}) _ verbosity builddir =
haddockHoogle = toFlag elabHaddockHoogle,
haddockHtml = toFlag elabHaddockHtml,
haddockHtmlLocation = maybe mempty toFlag elabHaddockHtmlLocation,
haddockForHackage = mempty, --TODO: new flag
--haddockForHackage = mempty, --TODO: new flag
haddockForHackage = toFlag elabHaddockForHackage,
haddockForeignLibs = toFlag elabHaddockForeignLibs,
haddockExecutables = toFlag elabHaddockExecutables,
haddockTestSuites = toFlag elabHaddockTestSuites,
......
......@@ -80,6 +80,7 @@ import Distribution.ModuleName (ModuleName)
import Distribution.Simple.LocalBuildInfo (ComponentName(..))
import qualified Distribution.Simple.InstallDirs as InstallDirs
import Distribution.Simple.InstallDirs (PathTemplate)
import Distribution.Simple.Setup (HaddockTarget)
import Distribution.Version
import qualified Distribution.Solver.Types.ComponentDeps as CD
......@@ -258,6 +259,7 @@ data ElaboratedConfiguredPackage
elabHaddockHtml :: Bool,
elabHaddockHtmlLocation :: Maybe String,
elabHaddockForeignLibs :: Bool,
elabHaddockForHackage :: HaddockTarget,
elabHaddockExecutables :: Bool,
elabHaddockTestSuites :: Bool,
elabHaddockBenchmarks :: Bool,
......@@ -347,6 +349,7 @@ instance IsNode ElaboratedConfiguredPackage where
nodeNeighbors = elabOrderDependencies
instance Binary ElaboratedConfiguredPackage
instance Binary HaddockTarget
data ElaboratedPackageOrComponent
= ElabPackage ElaboratedPackage
......
......@@ -1586,7 +1586,7 @@ haddockOptions showOrParseArgs
, name `elem` ["hoogle", "html", "html-location"
,"executables", "tests", "benchmarks", "all", "internal", "css"
,"hyperlink-source", "hscolour-css"
,"contents-location"]
,"contents-location", "for-hackage"]
]
where
fmapOptFlags :: (OptFlags -> OptFlags) -> OptDescr a -> OptDescr a
......
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