summaryrefslogtreecommitdiff
path: root/hadrian/src/Builder.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/Builder.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/Builder.hs')
-rw-r--r--hadrian/src/Builder.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs
index d09af9942e..02edb199d3 100644
--- a/hadrian/src/Builder.hs
+++ b/hadrian/src/Builder.hs
@@ -75,13 +75,13 @@ instance Hashable ConfigurationInfo
instance NFData ConfigurationInfo
-- TODO: Do we really need all these modes? Why do we need 'Dependencies'? We
--- can extract dependencies using the Cabal library.
+-- can extract dependencies using the Cabal library. Note: we used to also have
+-- the @Init@ mode for initialising a new package database but we've deleted it.
-- | 'GhcPkg' can initialise a package database and register packages in it.
-data GhcPkgMode = Init -- ^ Initialize a new database.
- | Update -- ^ Update a package.
- | Copy -- ^ Copy a package from one database to another.
- | Unregister -- ^ Unregister a package.
+data GhcPkgMode = Copy -- ^ Copy a package from one database to another.
| Dependencies -- ^ Compute package dependencies.
+ | Unregister -- ^ Unregister a package.
+ | Update -- ^ Update a package.
deriving (Eq, Generic, Show)
instance Binary GhcPkgMode
@@ -173,16 +173,18 @@ instance H.Builder Builder where
Autoreconf dir -> return [dir -/- "configure.ac"]
Configure dir -> return [dir -/- "configure"]
- Ghc _ Stage0 -> return []
+ Ghc _ Stage0 -> generatedGhcDependencies Stage0
Ghc _ stage -> do
root <- buildRoot
win <- windowsHost
touchyPath <- programPath (vanillaContext Stage0 touchy)
unlitPath <- builderPath Unlit
ghcdeps <- ghcDeps stage
+ ghcgens <- generatedGhcDependencies stage
return $ [ root -/- ghcSplitPath stage -- TODO: Make conditional on --split-objects
, unlitPath ]
++ ghcdeps
+ ++ ghcgens
++ [ touchyPath | win ]
Hsc2Hs stage -> (\p -> [p]) <$> templateHscPath stage