summaryrefslogtreecommitdiff
path: root/hadrian/src/Base.hs
diff options
context:
space:
mode:
authorAndrey Mokhov <andrey.mokhov@gmail.com>2019-02-14 14:29:50 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-02-20 09:59:16 -0500
commit1dad4fc27ea128a11ba0077f459494c2a1ca0d5c (patch)
treec5b569c56435e699c03fca5ad08cf03cb8b21b80 /hadrian/src/Base.hs
parent908b4b8659713f0b7a1704ce33c7fa30e3e0ffc3 (diff)
downloadhaskell-1dad4fc27ea128a11ba0077f459494c2a1ca0d5c.tar.gz
Hadrian: Fix untracked dependencies
This is a preparation for #16295: https://ghc.haskell.org/trac/ghc/ticket/16295 This commit mostly focuses on getting rid of untracked dependencies, which prevent Shake's new `--shared` feature from appropriately caching build rules. There are three different solutions to untracked dependencies: * Track them! This is the obvious and the best approach, but in some situations we cannot use it, for example, because a build rule creates files whose names are not known statically and hence cannot be specified as the rule's outputs. * Use Shake's `produces` to record outputs dynamically, within the rule. * Use Shake's `historyDisable` to disable caching for a particular build rule. We currently use this approach only for `ghc-pkg` which mutates the package database and the file `package.cache`. These two tickets are fixed as the result: Ticket #16271: ​https://ghc.haskell.org/trac/ghc/ticket/16271 Ticket #16272: ​https://ghc.haskell.org/trac/ghc/ticket/16272 (this one is fixed only partially: we correctly record the dependency, but we still copy files into the RTS build tree).
Diffstat (limited to 'hadrian/src/Base.hs')
-rw-r--r--hadrian/src/Base.hs22
1 files changed, 14 insertions, 8 deletions
diff --git a/hadrian/src/Base.hs b/hadrian/src/Base.hs
index 77eec0a48a..7949fcf4b2 100644
--- a/hadrian/src/Base.hs
+++ b/hadrian/src/Base.hs
@@ -24,7 +24,8 @@ module Base (
-- * Paths
hadrianPath, configPath, configFile, sourcePath, shakeFilesDir,
generatedDir, generatedPath, stageBinPath, stageLibPath, templateHscPath,
- ghcDeps, haddockDeps, relativePackageDbPath, packageDbPath, packageDbStamp,
+ ghcDeps, includesDependencies, haddockDeps, relativePackageDbPath,
+ packageDbPath, packageDbStamp,
ghcSplitPath
) where
@@ -106,15 +107,20 @@ stageBinPath stage = buildRoot <&> (-/- stageString stage -/- "bin")
stageLibPath :: Stage -> Action FilePath
stageLibPath stage = buildRoot <&> (-/- stageString stage -/- "lib")
--- | Files the `ghc` binary depends on
+-- | Files the GHC binary depends on.
ghcDeps :: Stage -> Action [FilePath]
ghcDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f))
- [ "ghc-usage.txt"
- , "ghci-usage.txt"
- , "llvm-targets"
- , "llvm-passes"
- , "platformConstants"
- , "settings" ]
+ [ "ghc-usage.txt"
+ , "ghci-usage.txt"
+ , "llvm-targets"
+ , "llvm-passes"
+ , "platformConstants"
+ , "settings" ]
+
+includesDependencies :: Action [FilePath]
+includesDependencies = do
+ path <- generatedPath
+ return $ (path -/-) <$> [ "ghcautoconf.h", "ghcplatform.h", "ghcversion.h" ]
-- | Files the `haddock` binary depends on
haddockDeps :: Stage -> Action [FilePath]