Commit c6d7b2a3 authored by Andrey Mokhov's avatar Andrey Mokhov

Fix missing dependency on package configuration

Also a minor revision.

See #421
parent 88a7b4e3
......@@ -22,7 +22,7 @@ module Base (
hadrianPath, configPath, configFile, sourcePath, configH, shakeFilesDir,
generatedDir, inplaceBinPath, inplaceLibBinPath, inplaceLibPath,
inplaceLibCopyTargets, templateHscPath, stage0PackageDbDir,
inplacePackageDbPath, packageDbStamp
inplacePackageDbPath, packageDbPath, packageDbStamp
) where
import Control.Applicative
......@@ -82,6 +82,11 @@ stage0PackageDbDir = "stage0/bootstrapping.conf"
inplacePackageDbPath :: FilePath
inplacePackageDbPath = "inplace/lib/package.conf.d"
-- | Path to the package database used in a given 'Stage'.
packageDbPath :: Stage -> Action FilePath
packageDbPath Stage0 = buildRoot <&> (-/- stage0PackageDbDir)
packageDbPath _ = return inplacePackageDbPath
-- | We use a stamp file to track the existence of a package database.
packageDbStamp :: FilePath
packageDbStamp = ".stamp"
......
......@@ -149,13 +149,13 @@ instance H.Builder Builder where
Just context -> programPath context
needBuilder :: Builder -> Action ()
needBuilder (Configure dir) = need [dir -/- "configure"]
needBuilder Hsc2Hs = do path <- H.builderPath Hsc2Hs
need [path, templateHscPath]
needBuilder (Make dir) = need [dir -/- "Makefile"]
needBuilder builder = when (isJust $ builderProvenance builder) $ do
needBuilder builder = do
path <- H.builderPath builder
need [path]
case builder of
Configure dir -> need [dir -/- "configure"]
Hsc2Hs -> need [path, templateHscPath]
Make dir -> need [dir -/- "Makefile"]
_ -> when (isJust $ builderProvenance builder) $ need [path]
runBuilderWith :: Builder -> BuildInfo -> Action ()
runBuilderWith builder BuildInfo {..} = do
......
......@@ -49,11 +49,9 @@ cWarnings = do
bootPackageDatabaseArgs :: Args
bootPackageDatabaseArgs = do
root <- getBuildRoot
stage <- getStage
let dbDir | stage == Stage0 = root -/- stage0PackageDbDir
| otherwise = inplacePackageDbPath
expr $ need [dbDir -/- packageDbStamp]
stage <- getStage
dbPath <- expr $ packageDbPath stage
expr $ need [dbPath -/- packageDbStamp]
stage0 ? do
top <- expr topDirectory
root <- getBuildRoot
......
module Settings.Builders.Ghc (
ghcBuilderArgs, ghcMBuilderArgs, haddockGhcArgs, ghcCbuilderArgs
ghcBuilderArgs, ghcCBuilderArgs, ghcMBuilderArgs, haddockGhcArgs
) where
import Hadrian.Haskell.Cabal
......@@ -24,9 +24,8 @@ needTouchy = notStage0 ? windowsHost ? do
touchyPath <- expr $ programPath (vanillaContext Stage0 touchy)
expr $ need [touchyPath]
ghcCbuilderArgs :: Args
ghcCbuilderArgs =
builder (Ghc CompileCWithGhc) ? do
ghcCBuilderArgs :: Args
ghcCBuilderArgs = builder (Ghc CompileCWithGhc) ? do
way <- getWay
let ccArgs = [ getPkgDataList CcArgs
, getStagedSettingList ConfCcArgs
......@@ -83,11 +82,16 @@ ghcMBuilderArgs = builder (Ghc FindHsDependencies) ? do
haddockGhcArgs :: Args
haddockGhcArgs = mconcat [ commonGhcArgs, getPkgDataList HsArgs ]
-- This is included into ghcBuilderArgs, ghcMBuilderArgs and haddockGhcArgs.
-- Used in ghcBuilderArgs, ghcCBuilderArgs, ghcMBuilderArgs and haddockGhcArgs.
commonGhcArgs :: Args
commonGhcArgs = do
way <- getWay
path <- getBuildPath
pkg <- getPackage
when (isLibrary pkg) $ do
context <- getContext
conf <- expr $ pkgConfFile context
expr $ need [conf]
mconcat [ arg "-hisuf", arg $ hisuf way
, arg "-osuf" , arg $ osuf way
, arg "-hcsuf", arg $ hcsuf way
......
......@@ -148,8 +148,8 @@ defaultBuilderArgs = mconcat
, deriveConstantsBuilderArgs
, genPrimopCodeBuilderArgs
, ghcBuilderArgs
, ghcCbuilderArgs
, ghcCabalBuilderArgs
, ghcCBuilderArgs
, ghcMBuilderArgs
, ghcPkgBuilderArgs
, haddockBuilderArgs
......
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