summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Sandberg Ericsson <adam@sandbergericsson.se>2020-12-05 22:44:12 +0000
committerBen Gamari <ben@smart-cactus.org>2020-12-17 21:33:25 -0500
commit48896a5aeb7f42c5d066a69ca68fc07e98a0b13c (patch)
tree01a0dc63e7791ac9c658890e0d81553bcff319a1
parentca506ea7457df6ff971abb65a4f94025813bb737 (diff)
downloadhaskell-48896a5aeb7f42c5d066a69ca68fc07e98a0b13c.tar.gz
hadrian: correctly copy the docs dir into the bindist #18669
(cherry picked from commit c647763954717d9853d08ff04eece7f1ddeae15c)
-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