summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Sandberg Ericsson <adam@sandbergericsson.se>2020-12-05 22:44:12 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-12 04:45:48 -0500
commitc647763954717d9853d08ff04eece7f1ddeae15c (patch)
tree806dd3da5a0822d3f9291158d0a16ca59f7e4599
parent3aae036eded89603756d025e0fac2ec0642edeaf (diff)
downloadhaskell-c647763954717d9853d08ff04eece7f1ddeae15c.tar.gz
hadrian: correctly copy the docs dir into the bindist #18669
-rw-r--r--hadrian/src/Rules/BinaryDist.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index 589c0e95fb..8709de6b26 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -12,6 +12,7 @@ import Settings
import Settings.Program (programContext)
import Target
import Utilities
+import qualified System.Directory.Extra as IO
{-
Note [Binary distributions]
@@ -136,13 +137,20 @@ bindistRules = do
copyDirectory (ghcBuildDir -/- "bin") bindistFilesDir
copyDirectory (ghcBuildDir -/- "lib") bindistFilesDir
copyDirectory (rtsIncludeDir) bindistFilesDir
+
unless cross $ need ["docs"]
+
-- TODO: we should only embed the docs that have been generated
-- depending on the current settings (flavours' "ghcDocs" field and
-- "--docs=.." command-line flag)
-- Currently we embed the "docs" directory if it exists but it may
-- contain outdated or even invalid data.
- whenM (doesDirectoryExist (root -/- "docs")) $ do
+
+ -- Use the IO version of doesDirectoryExist because the Shake Action
+ -- version should not be used for directories the build system can
+ -- create. Using the Action version caused documentation to not be
+ -- included in the bindist in the past (part of the problem in #18669).
+ whenM (liftIO (IO.doesDirectoryExist (root -/- "docs"))) $ do
copyDirectory (root -/- "docs") bindistFilesDir
when windowsHost $ do
copyDirectory (root -/- "mingw") bindistFilesDir