File tree Expand file tree Collapse file tree 5 files changed +47
-1
lines changed
Cabal/src/Distribution/Simple
cabal-testsuite/PackageTests/HaddockArtifacts Expand file tree Collapse file tree 5 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -1071,7 +1071,13 @@ reusingGHCCompilationArtifacts verbosity tmpFileOpts mbWorkDir lbi bi clbi versi
1071
1071
let
1072
1072
vanillaOpts = componentGhcOptions normal lbi bi clbi (buildDir lbi)
1073
1073
i = interpretSymbolicPath mbWorkDir
1074
- copyDir ghcDir tmpDir = copyDirectoryRecursive verbosity (i $ fromFlag $ ghcDir vanillaOpts) (i tmpDir)
1074
+ copyDir getGhcDir tmpDir = do
1075
+ let ghcDir = i $ fromFlag $ getGhcDir vanillaOpts
1076
+ ghcDirExists <- doesDirectoryExist ghcDir
1077
+ -- Don't try to copy artifacts if they don't exist, e.g. if
1078
+ -- we have not yet run the 'build' command.
1079
+ when ghcDirExists $
1080
+ copyDirectoryRecursive verbosity ghcDir (i tmpDir)
1075
1081
copyDir ghcOptObjDir tmpObjDir
1076
1082
copyDir ghcOptHiDir tmpHiDir
1077
1083
-- copyDir ghcOptStubDir tmpStubDir -- (see W.1 in Note [Hi Haddock Recompilation Avoidance])
Original file line number Diff line number Diff line change
1
+ name : a
2
+ version : 0.1.0.0
3
+ build-type : Simple
4
+ cabal-version : >= 1.10
5
+
6
+ library
7
+ exposed-modules : MyLib
8
+ build-depends : base
9
+ hs-source-dirs : src
10
+ default-language : Haskell2010
Original file line number Diff line number Diff line change
1
+ import Test.Cabal.Prelude
2
+
3
+ import System.Directory
4
+ import System.FilePath
5
+
6
+ main = setupTest . recordMode DoNotRecord $ do
7
+ workDir <- fmap testWorkDir getTestEnv
8
+ setup " configure" []
9
+ setup " build" []
10
+ liftIO $ removeDirectoryRecursive $ workDir </> " work" </> " dist" </> " build"
11
+ setup " haddock" []
Original file line number Diff line number Diff line change
1
+ module MyLib where
2
+
3
+ -- | Some docs
4
+ foo :: Int
5
+ foo = 3
6
+
7
+ -- | More docs
8
+ data A = A Int -- ^ field
Original file line number Diff line number Diff line change
1
+ ---
2
+ synopsis : " Haddock: don't try to copy build dir if it doesn't exist"
3
+ packages : [Cabal]
4
+ prs : 10992
5
+ issues : [11001]
6
+ ---
7
+
8
+ This small patch fixes a little oversight in 'reusingGHCCompilationArtifacts',
9
+ which would unconditionally attempt to copy over the GHC build artifacts to be
10
+ re-used by Haddock, even when those artifacts did not exist (which caused
11
+ an error).
You can’t perform that action at this time.
0 commit comments