Skip to content

Commit 58a6861

Browse files
committed
Update Haddock documentation related to building with Haddock
1 parent 738fe1d commit 58a6861

File tree

4 files changed

+45
-29
lines changed

4 files changed

+45
-29
lines changed

src/Stack/Build/ConstructPlan.hs

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,13 @@ mkUnregisterLocal tasks dirtyReason localDumpPkgs initialBuildSteps =
502502
-- This will also add all the deps needed to build the tests / benchmarks. If
503503
-- @isAllInOne@ is 'True' (the common case), then all of these should have
504504
-- already been taken care of as part of the build step.
505-
addFinal :: LocalPackage -> Package -> Bool -> Bool -> M ()
505+
addFinal ::
506+
LocalPackage
507+
-> Package
508+
-> Bool
509+
-> Bool
510+
-- ^ Should Haddock documentation be built?
511+
-> M ()
506512
addFinal lp package isAllInOne buildHaddocks = do
507513
depsRes <- addPackageDeps package
508514
res <- case depsRes of
@@ -760,12 +766,14 @@ installPackage name ps minstalled = do
760766
pure $ Set.member name (curatorExpectTestFailure curator) ||
761767
Set.member name (curatorExpectBenchmarkFailure curator)
762768

763-
resolveDepsAndInstall :: Bool
764-
-> Bool
765-
-> PackageSource
766-
-> Package
767-
-> Maybe Installed
768-
-> M (Either ConstructPlanException AddDepRes)
769+
resolveDepsAndInstall ::
770+
Bool
771+
-> Bool
772+
-- ^ Should Haddock documentation be built?
773+
-> PackageSource
774+
-> Package
775+
-> Maybe Installed
776+
-> M (Either ConstructPlanException AddDepRes)
769777
resolveDepsAndInstall isAllInOne buildHaddocks ps package minstalled = do
770778
res <- addPackageDeps package
771779
case res of
@@ -778,15 +786,17 @@ resolveDepsAndInstall isAllInOne buildHaddocks ps package minstalled = do
778786
-- | Checks if we need to install the given 'Package', given the results
779787
-- of 'addPackageDeps'. If dependencies are missing, the package is dirty, or
780788
-- it's not installed, then it needs to be installed.
781-
installPackageGivenDeps :: Bool
782-
-> Bool
783-
-> PackageSource
784-
-> Package
785-
-> Maybe Installed
786-
-> ( Set PackageIdentifier
787-
, Map PackageIdentifier GhcPkgId
788-
, IsMutable )
789-
-> M AddDepRes
789+
installPackageGivenDeps ::
790+
Bool
791+
-> Bool
792+
-- ^ Should Haddock documentation be built?
793+
-> PackageSource
794+
-> Package
795+
-> Maybe Installed
796+
-> ( Set PackageIdentifier
797+
, Map PackageIdentifier GhcPkgId
798+
, IsMutable )
799+
-> M AddDepRes
790800
installPackageGivenDeps isAllInOne buildHaddocks ps package minstalled
791801
(missing, present, minMutable) = do
792802
let name = packageName package
@@ -1046,12 +1056,14 @@ addPackageDeps package = do
10461056
HasLibraries _ -> True
10471057
NoLibraries -> False
10481058

1049-
checkDirtiness :: PackageSource
1050-
-> Installed
1051-
-> Package
1052-
-> Map PackageIdentifier GhcPkgId
1053-
-> Bool
1054-
-> M Bool
1059+
checkDirtiness ::
1060+
PackageSource
1061+
-> Installed
1062+
-> Package
1063+
-> Map PackageIdentifier GhcPkgId
1064+
-> Bool
1065+
-- ^ Is Haddock documentation being built?
1066+
-> M Bool
10551067
checkDirtiness ps installed package present buildHaddocks = do
10561068
ctx <- ask
10571069
moldOpts <- runRIO ctx $ tryGetFlagCache installed

src/Stack/SourceMap.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ mkProjectPackage ::
5656
=> PrintWarnings
5757
-> ResolvedPath Dir
5858
-> Bool
59+
-- ^ Should Haddock documentation be built for the package?
5960
-> RIO env ProjectPackage
6061
mkProjectPackage printWarnings dir buildHaddocks = do
6162
(gpd, name, cabalfp) <-

src/Stack/Types/Package.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,11 @@ psVersion :: PackageSource -> Version
290290
psVersion (PSFilePath lp) = packageVersion $ lpPackage lp
291291
psVersion (PSRemote _ v _ _) = v
292292

293-
-- | Information on a locally available package of source code
293+
-- | Information on a locally available package of source code.
294294
data LocalPackage = LocalPackage
295295
{ lpPackage :: !Package
296-
-- ^ The @Package@ info itself, after resolution with package flags,
297-
-- with tests and benchmarks disabled
296+
-- ^ The @Package@ info itself, after resolution with package flags, with
297+
-- tests and benchmarks disabled
298298
, lpComponents :: !(Set NamedComponent)
299299
-- ^ Components to build, not including the library component.
300300
, lpUnbuildable :: !(Set NamedComponent)
@@ -304,11 +304,12 @@ data LocalPackage = LocalPackage
304304
-- terminology, it's unclear
305305
-- ^ Whether this package is wanted as a target.
306306
, lpTestBench :: !(Maybe Package)
307-
-- ^ This stores the 'Package' with tests and benchmarks enabled, if
308-
-- either is asked for by the user.
307+
-- ^ This stores the 'Package' with tests and benchmarks enabled, if either
308+
-- is asked for by the user.
309309
, lpCabalFile :: !(Path Abs File)
310310
-- ^ The Cabal file
311311
, lpBuildHaddocks :: !Bool
312+
-- ^ Is Haddock documentation being built for this package?
312313
, lpForceDirty :: !Bool
313314
, lpDirtyFiles :: !(MemoizedWith EnvConfig (Maybe (Set FilePath)))
314315
-- ^ Nothing == not dirty, Just == dirty. Note that the Set may be empty if

src/Stack/Types/SourceMap.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ import Stack.Prelude
3838
import Stack.Types.Compiler ( ActualCompiler )
3939
import Stack.Types.NamedComponent ( NamedComponent (..) )
4040

41-
-- | Common settings for both dependency and project package.
41+
-- | Settings common to dependency packages ('Stack.Types.SourceMap.DepPackage')
42+
-- and project packages ('Stack.Types.SourceMap.ProjectPackage').
4243
data CommonPackage = CommonPackage
4344
{ cpGPD :: !(IO GenericPackageDescription)
4445
, cpName :: !PackageName
@@ -48,6 +49,7 @@ data CommonPackage = CommonPackage
4849
-- also lets us know if we're doing profiling
4950
, cpCabalConfigOpts :: ![Text]
5051
, cpHaddocks :: !Bool
52+
-- ^ Should Haddock documentation be built for this package?
5153
}
5254

5355
-- | Flag showing if package comes from a snapshot needed to ignore dependency
@@ -72,7 +74,7 @@ data DepPackage = DepPackage
7274
-- | A view of a project package needed for resolving components
7375
data ProjectPackage = ProjectPackage
7476
{ ppCommon :: !CommonPackage
75-
, ppCabalFP :: !(Path Abs File)
77+
, ppCabalFP :: !(Path Abs File)
7678
, ppResolvedDir :: !(ResolvedPath Dir)
7779
}
7880

0 commit comments

Comments
 (0)