Skip to content

Commit ebdc279

Browse files
committed
Hi Haddock: don't try to copy artifacts that don't exist
1 parent ffaa46b commit ebdc279

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Cabal/src/Distribution/Simple/Haddock.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,13 @@ reusingGHCCompilationArtifacts verbosity tmpFileOpts mbWorkDir lbi bi clbi versi
10711071
let
10721072
vanillaOpts = componentGhcOptions normal lbi bi clbi (buildDir lbi)
10731073
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)
10751081
copyDir ghcOptObjDir tmpObjDir
10761082
copyDir ghcOptHiDir tmpHiDir
10771083
-- copyDir ghcOptStubDir tmpStubDir -- (see W.1 in Note [Hi Haddock Recompilation Avoidance])

0 commit comments

Comments
 (0)