Commit a5227080 authored by Alp Mestanogullari's avatar Alp Mestanogullari Committed by Marge Bot

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.
parent e3cbe319
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment