diff options
author | Alp Mestanogullari <alpmestan@gmail.com> | 2019-08-01 12:30:41 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-08-02 22:22:06 -0400 |
commit | a5227080b57cb51ac34d4c9de1accdf6360b818b (patch) | |
tree | 41e33bf25119547ab73c974c996a24faed776b10 /hadrian | |
parent | e3cbe319dbe2f6a64ea3108dcd8d42e7876e5b34 (diff) | |
download | haskell-a5227080b57cb51ac34d4c9de1accdf6360b818b.tar.gz |
Hadrian: make settings, platformConstants, etc dependencies of lib:ghc
This fixes #17003, where a user directly asked for the 'docs-haddock' target
without building a complete stage 2 GHC first. Since haddock only depends on
lib:ghc, the stage 2 GHC executable wasn't built, and neither were the
settings, platformConstants, llvm-passes and llvm-targets files, since they
are declared to be dependencies of exe:ghc.
This makes sense in general since all GHC API users (haddock is one) will likely
want those files to be there.
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/src/Base.hs | 22 | ||||
-rw-r--r-- | hadrian/src/Builder.hs | 2 | ||||
-rw-r--r-- | hadrian/src/Rules/Program.hs | 5 | ||||
-rw-r--r-- | hadrian/src/Rules/Register.hs | 8 |
4 files changed, 19 insertions, 18 deletions
diff --git a/hadrian/src/Base.hs b/hadrian/src/Base.hs index 19573de8fd..bc4eab354e 100644 --- a/hadrian/src/Base.hs +++ b/hadrian/src/Base.hs @@ -24,8 +24,8 @@ module Base ( -- * Paths hadrianPath, configPath, configFile, sourcePath, shakeFilesDir, generatedDir, generatedPath, stageBinPath, stageLibPath, templateHscPath, - ghcDeps, includesDependencies, haddockDeps, relativePackageDbPath, - packageDbPath, packageDbStamp, mingwStamp, + ghcBinDeps, ghcLibDeps, includesDependencies, haddockDeps, + relativePackageDbPath, packageDbPath, packageDbStamp, mingwStamp, ) where import Control.Applicative @@ -106,15 +106,21 @@ stageBinPath stage = buildRoot <&> (-/- stageString stage -/- "bin") stageLibPath :: Stage -> Action FilePath stageLibPath stage = buildRoot <&> (-/- stageString stage -/- "lib") +-- | Files the GHC library depends on +ghcLibDeps :: Stage -> Action [FilePath] +ghcLibDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f)) + [ "llvm-targets" + , "llvm-passes" + , "platformConstants" + , "settings" + ] + -- | Files the GHC binary depends on. -ghcDeps :: Stage -> Action [FilePath] -ghcDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f)) +ghcBinDeps :: Stage -> Action [FilePath] +ghcBinDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f)) [ "ghc-usage.txt" , "ghci-usage.txt" - , "llvm-targets" - , "llvm-passes" - , "platformConstants" - , "settings" ] + ] includesDependencies :: Action [FilePath] includesDependencies = do diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs index 581161f984..892f89772d 100644 --- a/hadrian/src/Builder.hs +++ b/hadrian/src/Builder.hs @@ -184,7 +184,7 @@ instance H.Builder Builder where -- GHC from the previous stage is used to build artifacts in the -- current stage. Need the previous stage's GHC deps. - ghcdeps <- ghcDeps (pred stage) + ghcdeps <- ghcBinDeps (pred stage) return $ [ unlitPath ] ++ ghcdeps diff --git a/hadrian/src/Rules/Program.hs b/hadrian/src/Rules/Program.hs index 96855a3927..b5dde25624 100644 --- a/hadrian/src/Rules/Program.hs +++ b/hadrian/src/Rules/Program.hs @@ -83,10 +83,7 @@ buildProgram bin ctx@(Context{..}) rs = do template <- templateHscPath stage need [template] when (package == ghc) $ do - -- GHC depends on @settings@, @platformConstants@, - -- @llvm-targets@, @ghc-usage.txt@, @ghci-usage.txt@, - -- @llvm-passes@. - need =<< ghcDeps stage + need =<< ghcBinDeps stage when (package == haddock) $ do -- Haddock has a resource folder need =<< haddockDeps stage diff --git a/hadrian/src/Rules/Register.hs b/hadrian/src/Rules/Register.hs index 4275ab1fa2..e9451c2648 100644 --- a/hadrian/src/Rules/Register.hs +++ b/hadrian/src/Rules/Register.hs @@ -90,14 +90,12 @@ registerPackageRules rs stage = do -- Register a package. root -/- relativePackageDbPath stage -/- "*.conf" %> \conf -> do historyDisable - let libpath = takeDirectory (takeDirectory conf) - settings = libpath -/- "settings" - platformConstants = libpath -/- "platformConstants" - - need [settings, platformConstants] pkgName <- getPackageNameFromConfFile conf let pkg = unsafeFindPackageByName pkgName + + when (pkg == compiler) $ need =<< ghcLibDeps stage + isBoot <- (pkg `notElem`) <$> stagePackages Stage0 let ctx = Context stage pkg vanilla |