Skip to content

Commit 409301f

Browse files
committed
unbreak cabal haddock --disable-documentation
1 parent 8cf1695 commit 409301f

File tree

7 files changed

+43
-1
lines changed

7 files changed

+43
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
flags' = flags { installFlags = installFlags { installDocumentation = Flag True } }
144+
installDoc = fromFlagOrDefault True (installDocumentation installFlags)
145+
flags' = flags { installFlags = installFlags { installDocumentation = Flag installDoc } }
145146
cliConfig = commandLineFlagsToProjectConfig globalFlags flags' mempty -- ClientInstallFlags, not needed here
146147

147148
-- | This defines what a 'TargetSelector' means for the @haddock@ command.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cabal-version: 2.4
2+
name: B
3+
version: 0.1.0.0
4+
author: Artem Pelenitsyn
5+
maintainer: [email protected]
6+
7+
library
8+
exposed-modules: B
9+
build-depends: base
10+
, A
11+
hs-source-dirs: .
12+
default-language: Haskell2010
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- | Module using external dependency and mentioning it in haddocks
2+
module B (b) where
3+
4+
import A
5+
6+
-- | Use 'a'
7+
b :: Int
8+
b = a
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: B
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 --disable-documention` works as expected and leads
3+
-- to a failure if a local package makes an outer reference.
4+
main = cabalTest . withRepo "repo" . fails $
5+
cabal "haddock" ["--disable-documentation", "B"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cabal-version: 2.4
2+
name: A
3+
version: 0.1.0.0
4+
author: Artem Pelenitsyn
5+
maintainer: [email protected]
6+
7+
library
8+
exposed-modules: A
9+
build-depends: base
10+
hs-source-dirs: .
11+
default-language: Haskell2010
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module A (a) where
2+
3+
a :: Int
4+
a = 42

0 commit comments

Comments
 (0)