Skip to content

Commit 5f395e6

Browse files
authored
Merge branch 'master' into patch-1
2 parents feacf4e + a47b0ad commit 5f395e6

File tree

8 files changed

+60
-1
lines changed

8 files changed

+60
-1
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ haddockAction flags@NixStyleFlags {..} targetStrings globalFlags = do
143143
runProjectPostBuildPhase verbosity baseCtx buildCtx' buildOutcomes
144144
where
145145
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
146-
flags' = flags { installFlags = installFlags { installDocumentation = Flag True } }
146+
installDoc = fromFlagOrDefault True (installDocumentation installFlags)
147+
flags' = flags { installFlags = installFlags { installDocumentation = Flag installDoc } }
147148
cliConfig = commandLineFlagsToProjectConfig globalFlags flags' mempty -- ClientInstallFlags, not needed here
148149

149150
-- | This defines what a 'TargetSelector' means for the @haddock@ command.
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
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# cabal v2-update
2+
Downloading the latest package list from test-local-repo
3+
# cabal haddock
4+
Resolving dependencies...
5+
Build profile: -w ghc-<GHCVER> -O1
6+
In order, the following will be built:
7+
- A-0.1.0.0 (lib) (requires build)
8+
- B-0.1.0.0 (lib) (first run)
9+
Configuring library for A-0.1.0.0..
10+
Preprocessing library for A-0.1.0.0..
11+
Building library for A-0.1.0.0..
12+
Installing library in <PATH>
13+
Configuring library for B-0.1.0.0..
14+
Preprocessing library for B-0.1.0.0..
15+
Running Haddock on library for B-0.1.0.0..
16+
Documentation created: <ROOT>/cabal.dist/work/dist/build/<ARCH>/ghc-<GHCVER>/B-0.1.0.0/doc/html/B/index.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: B
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Test.Cabal.Prelude
2+
-- Test that `cabal haddock --disable-documention` works as expected and leads
3+
-- to a warning if a local package makes an outer reference.
4+
main = cabalTest . withRepo "repo" $ do
5+
r <- cabal' "haddock" ["--disable-documentation", "B"]
6+
assertOutputContains "Warning: B: could not find link destinations for" r
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
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)