Skip to content

Commit 0d2d9ca

Browse files
authored
Merge pull request #6137 from haskell/issue-5977
Issue 5977
2 parents 48a8aa2 + 73751a9 commit 0d2d9ca

File tree

7 files changed

+41
-3
lines changed

7 files changed

+41
-3
lines changed

cabal-install/Distribution/Client/CmdHaddock.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ haddockAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFl
7474
haddockAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
7575
targetStrings globalFlags = do
7676

77-
baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand
77+
baseCtx <- establishProjectBaseContext verbosity cliConfig HaddockCommand
7878

7979
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
8080
=<< readTargetSelectors (localPackages baseCtx) Nothing targetStrings

cabal-install/Distribution/Client/ProjectOrchestration.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ import System.Posix.Signals (sigKILL, sigSEGV)
171171

172172
-- | Tracks what command is being executed, because we need to hide this somewhere
173173
-- for cases that need special handling (usually for error reporting).
174-
data CurrentCommand = InstallCommand | OtherCommand
174+
data CurrentCommand = InstallCommand | HaddockCommand | OtherCommand
175175
deriving (Show, Eq)
176176

177177
-- | This holds the context of a project prior to solving: the content of the
@@ -431,7 +431,7 @@ runProjectPostBuildPhase verbosity
431431

432432
-- Finally if there were any build failures then report them and throw
433433
-- an exception to terminate the program
434-
dieOnBuildFailures verbosity currentCommand elaboratedPlanToExecute buildOutcomes
434+
dieOnBuildFailures verbosity currentCommand elaboratedPlanToExecute buildOutcomes
435435

436436
-- Note that it is a deliberate design choice that the 'buildTargets' is
437437
-- not passed to phase 1, and the various bits of input config is not
@@ -1030,6 +1030,7 @@ dieOnBuildFailures verbosity currentCommand plan buildOutcomes
10301030
]
10311031

10321032
dieIfNotHaddockFailure
1033+
| currentCommand == HaddockCommand = die'
10331034
| all isHaddockFailure failuresClassification = warn
10341035
| otherwise = die'
10351036
where
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Example where
2+
3+
import Prelude
4+
5+
example :: Int
6+
example = False
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# cabal v2-build
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- example-1.0 (lib) (first run)
6+
Configuring library for example-1.0..
7+
Preprocessing library for example-1.0..
8+
Building library for example-1.0..
9+
# cabal v2-haddock
10+
Build profile: -w ghc-<GHCVER> -O1
11+
In order, the following will be built:
12+
- example-1.0 (lib) (first run)
13+
Preprocessing library for example-1.0..
14+
Running Haddock on library for example-1.0..
15+
cabal: Failed to build documentation for example-1.0-inplace.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: .
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Test.Cabal.Prelude
2+
import System.Exit (ExitCode (..))
3+
4+
main = cabalTest $ do
5+
fails $ cabal "v2-build" ["example"]
6+
fails $ cabal "v2-haddock" ["example"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: example
2+
version: 1.0
3+
build-type: Simple
4+
cabal-version: >=1.10
5+
6+
library
7+
default-language: Haskell2010
8+
build-depends: base
9+
exposed-modules: Example

0 commit comments

Comments
 (0)