Skip to content

Commit 8c7696e

Browse files
committed
cabal haddock imply enable-documentation
1 parent 1da1893 commit 8c7696e

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

cabal-install/src/Distribution/Client/CmdHaddock.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Distribution.Client.TargetProblem
2424
import Distribution.Client.NixStyleOptions
2525
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
2626
import Distribution.Client.Setup
27-
( GlobalFlags, ConfigFlags(..) )
27+
( GlobalFlags, ConfigFlags(..), InstallFlags (..))
2828
import Distribution.Simple.Setup
2929
( HaddockFlags(..), fromFlagOrDefault, trueArg )
3030
import Distribution.Simple.Command
@@ -141,7 +141,8 @@ haddockAction flags@NixStyleFlags {..} targetStrings globalFlags = do
141141
runProjectPostBuildPhase verbosity baseCtx buildCtx' buildOutcomes
142142
where
143143
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
144-
cliConfig = commandLineFlagsToProjectConfig globalFlags flags mempty -- ClientInstallFlags, not needed here
144+
flags' = flags { installFlags = installFlags { installDocumentation = Flag True } }
145+
cliConfig = commandLineFlagsToProjectConfig globalFlags flags' mempty -- ClientInstallFlags, not needed here
145146

146147
-- | This defines what a 'TargetSelector' means for the @haddock@ command.
147148
-- It selects the 'AvailableTarget's that the 'TargetSelector' refers to,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module Lib where
2+
3+
import Text.PrettyPrint (render, text)
4+
5+
-- | Rendering using 'text' and 'render'
6+
myLibFunc :: IO ()
7+
myLibFunc = do
8+
putStrLn (render (text "foo"))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Test.Cabal.Prelude
2+
-- Test that `cabal haddock` doesn't require explicit
3+
-- `--enable-dependencies` to happily process links to external packages
4+
main = cabalTest $
5+
cabal "haddock" ["lib"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: test
2+
version: 1.0
3+
cabal-version: >= 1.10
4+
author: Artem Pelenitsyn
5+
category: PackageTests
6+
build-type: Simple
7+
8+
description:
9+
Check that `cabal haddock` implies `--enable-dependencies`
10+
---------------------------------------
11+
12+
Library
13+
exposed-modules: Lib
14+
build-depends: base, pretty

0 commit comments

Comments
 (0)