Commit 2b26e75b authored by Duncan Coutts's avatar Duncan Coutts

Extend DistDirLayout with project root and cabal.project

So the DistDirLayout now contains the root dir of the project as a
whole, which eliminates the need to pass it separately in several cases.
It also contains the location of the cabal.project file, which again
avoids having to pass it around.

In part these changes were to allow the elimination of uses of the
legacy config types in the new-build code. The idea is that the legacy
config types are only used by conversion into the new config types, and
then only the new types are used in the new code.
parent 8be0062c
......@@ -71,7 +71,6 @@ benchAction (configFlags, configExFlags, installFlags, haddockFlags)
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
configFlags installFlags --TODO: eliminate use of legacy config types
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
=<< readTargetSelectors (localPackages baseCtx) targetStrings
......
......@@ -75,7 +75,6 @@ buildAction (configFlags, configExFlags, installFlags, haddockFlags)
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
configFlags installFlags --TODO: eliminate use of legacy config types
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
=<< readTargetSelectors (localPackages baseCtx) targetStrings
......
......@@ -81,11 +81,10 @@ configureAction (configFlags, configExFlags, installFlags, haddockFlags)
--TODO: deal with _extraArgs, since flags with wrong syntax end up there
baseCtx <- establishProjectBaseContext verbosity cliConfig
configFlags installFlags --TODO: eliminate use of legacy config types
-- Write out the @cabal.project.local@ so it gets picked up by the
-- planning phase.
writeProjectLocalExtraConfig installFlags (projectRootDir baseCtx)
writeProjectLocalExtraConfig (distDirLayout baseCtx)
cliConfig
buildCtx <-
......
......@@ -7,11 +7,11 @@ module Distribution.Client.CmdFreeze (
freezeAction,
) where
import Distribution.Client.ProjectOrchestration
import Distribution.Client.ProjectPlanning
import Distribution.Client.ProjectConfig
( ProjectConfig(..), ProjectConfigShared(..)
, commandLineFlagsToProjectConfig, writeProjectLocalFreezeConfig
, findProjectRoot, getProjectFileName )
, writeProjectLocalFreezeConfig )
import Distribution.Client.Targets
( UserQualifier(..), UserConstraintScope(..), UserConstraint(..) )
import Distribution.Solver.Types.PackageConstraint
......@@ -19,9 +19,7 @@ import Distribution.Solver.Types.PackageConstraint
import Distribution.Solver.Types.ConstraintSource
( ConstraintSource(..) )
import Distribution.Client.DistDirLayout
( defaultDistDirLayout, defaultCabalDirLayout )
import Distribution.Client.Config
( defaultCabalDir )
( DistDirLayout(distProjectFile) )
import qualified Distribution.Client.InstallPlan as InstallPlan
......@@ -45,7 +43,6 @@ import Data.Monoid as Monoid
import qualified Data.Map as Map
import Data.Map (Map)
import Control.Monad (unless)
import System.FilePath
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
......@@ -113,35 +110,29 @@ freezeAction (configFlags, configExFlags, installFlags, haddockFlags)
die' verbosity $ "'freeze' doesn't take any extra arguments: "
++ unwords extraArgs
cabalDir <- defaultCabalDir
let cabalDirLayout = defaultCabalDirLayout cabalDir
projectRootDir <- findProjectRoot installFlags
let distDirLayout = defaultDistDirLayout configFlags projectRootDir
let cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags haddockFlags
(projectConfig, localPackages) <-
rebuildProjectConfig verbosity
installFlags --TODO: eliminate
projectRootDir distDirLayout
cliConfig
ProjectBaseContext {
distDirLayout,
cabalDirLayout,
projectConfig,
localPackages
} <- establishProjectBaseContext verbosity cliConfig
(_, elaboratedPlan, _) <-
rebuildInstallPlan verbosity
projectRootDir distDirLayout cabalDirLayout
distDirLayout cabalDirLayout
projectConfig
localPackages
let freezeConfig = projectFreezeConfig elaboratedPlan
writeProjectLocalFreezeConfig installFlags projectRootDir freezeConfig
writeProjectLocalFreezeConfig distDirLayout freezeConfig
notice verbosity $
"Wrote freeze file: " ++ projectRootDir </> getProjectFileName installFlags <.> "freeze"
"Wrote freeze file: " ++ distProjectFile distDirLayout "freeze"
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags haddockFlags
......
......@@ -69,7 +69,6 @@ haddockAction (configFlags, configExFlags, installFlags, haddockFlags)
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
configFlags installFlags --TODO: eliminate use of legacy config types
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
=<< readTargetSelectors (localPackages baseCtx) targetStrings
......
......@@ -77,7 +77,6 @@ replAction (configFlags, configExFlags, installFlags, haddockFlags)
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
configFlags installFlags --TODO: eliminate use of legacy config types
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
=<< readTargetSelectors (localPackages baseCtx) targetStrings
......
......@@ -76,7 +76,6 @@ runAction (configFlags, configExFlags, installFlags, haddockFlags)
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
configFlags installFlags --TODO: eliminate use of legacy config types
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
=<< readTargetSelectors (localPackages baseCtx) targetStrings
......
......@@ -74,7 +74,6 @@ testAction (configFlags, configExFlags, installFlags, haddockFlags)
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
configFlags installFlags --TODO: eliminate use of legacy config types
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
=<< readTargetSelectors (localPackages baseCtx) targetStrings
......
......@@ -16,8 +16,9 @@ module Distribution.Client.DistDirLayout (
defaultCabalDirLayout,
) where
import Data.Maybe (fromMaybe)
import System.FilePath
import Distribution.Simple.Setup (fromFlagOrDefault, ConfigFlags, configDistPref)
import Distribution.Package
( PackageId, ComponentId, UnitId )
import Distribution.Compiler
......@@ -52,8 +53,19 @@ data DistDirParams = DistDirParams {
--
data DistDirLayout = DistDirLayout {
-- | The dist directory, which is the root of where cabal keeps all its
-- state including the build artifacts from each package we build.
-- | The root directory of the project. Many other files are relative to
-- this location. In particular, the @cabal.project@ lives here.
--
distProjectRootDirectory :: FilePath,
-- | The @cabal.project@ file and related like @cabal.project.freeze@.
-- The parameter is for the extension, like \"freeze\", or \"\" for the
-- main file.
--
distProjectFile :: String -> FilePath,
-- | The \"dist\" directory, which is the root of where cabal keeps all
-- its state including the build artifacts from each package we build.
--
distDirectory :: FilePath,
......@@ -107,14 +119,24 @@ data CabalDirLayout = CabalDirLayout {
cabalWorldFile :: FilePath
}
-- | Given the path to the root directory, create the 'DistDirLayout'
-- associated with it. Respects @--builddir@ setting.
defaultDistDirLayout :: ConfigFlags -> FilePath -> DistDirLayout
defaultDistDirLayout configFlags projectRootDirectory =
-- | Make the default 'DistDirLayout' based on the project root dir and
-- optional overrides for the location of the @dist@ directory and the
-- @cabal.project@ file.
--
defaultDistDirLayout :: FilePath -- ^ the project root directory (absolute)
-> Maybe FilePath -- ^ the @dist@ directory or default
-- (absolute or relative to the root)
-> Maybe FilePath -- ^ the @cabal.project@ file or default
-- (absolute or relative to the root)
-> DistDirLayout
defaultDistDirLayout projectRootDir mdistDirectory mprojectFile =
DistDirLayout {..}
where
distDirName = fromFlagOrDefault "dist-newstyle" (configDistPref configFlags)
distDirectory = projectRootDirectory </> distDirName
distProjectRootDirectory = projectRootDir
distProjectFile ext = projectRootDir
</> fromMaybe "cabal.project" mprojectFile <.> ext
distDirectory = projectRootDir </> fromMaybe "dist-newstyle" mdistDirectory
--TODO: switch to just dist at some point, or some other new name
distBuildRootDirectory = distDirectory </> "build"
......
......@@ -18,6 +18,7 @@ import Distribution.Client.Config
import Distribution.Client.IndexUtils as IndexUtils
import Distribution.Client.Compat.Prelude
import Distribution.Client.ProjectConfig
import Distribution.Client.DistDirLayout
import Distribution.Client.RebuildMonad
import Distribution.Client.Setup hiding (quiet)
import Distribution.Client.Targets
......@@ -126,8 +127,9 @@ depsFromFreezeFile verbosity = do
depsFromNewFreezeFile :: Verbosity -> IO [Dependency]
depsFromNewFreezeFile verbosity = do
projectRootDir <- findProjectRoot {- TODO: Support '--project-file' -} mempty
projectConfig <- runRebuild projectRootDir $
readProjectLocalFreezeConfig verbosity mempty projectRootDir
let distDirLayout = defaultDistDirLayout projectRootDir Nothing Nothing
projectConfig <- runRebuild (distProjectRootDirectory distDirLayout) $
readProjectLocalFreezeConfig verbosity distDirLayout
let ucnstrs = map fst . projectConfigConstraints . projectConfigShared
$ projectConfig
deps = userConstraintsToDependencies ucnstrs
......
......@@ -38,7 +38,6 @@ module Distribution.Client.ProjectConfig (
resolveSolverSettings,
BuildTimeSettings(..),
resolveBuildTimeSettings,
getProjectFileName,
-- * Checking configuration
checkBadPerPackageCompilerPaths,
......@@ -56,7 +55,7 @@ import Distribution.Client.Glob
import Distribution.Client.Types
import Distribution.Client.DistDirLayout
( CabalDirLayout(..) )
( DistDirLayout(..), CabalDirLayout(..) )
import Distribution.Client.GlobalFlags
( RepoContext(..), withRepoContext' )
import Distribution.Client.BuildReports.Types
......@@ -89,7 +88,7 @@ import Distribution.Simple.Setup
( Flag(Flag), toFlag, flagToMaybe, flagToList
, fromFlag, fromFlagOrDefault, AllowNewer(..), AllowOlder(..), RelaxDeps(..) )
import Distribution.Client.Setup
( defaultSolver, defaultMaxBackjumps, InstallFlags, installProjectFileName )
( defaultSolver, defaultMaxBackjumps )
import Distribution.Simple.InstallDirs
( PathTemplate, fromPathTemplate
, toPathTemplate, substPathTemplate, initialPathTemplateEnv )
......@@ -343,20 +342,25 @@ resolveBuildTimeSettings verbosity
-- Reading and writing project config files
--
getProjectFileName :: InstallFlags -> FilePath
getProjectFileName installFlags =
fromFlagOrDefault "cabal.project" (installProjectFileName installFlags)
-- | Find the root of this project.
--
-- Searches for an explicit @cabal.project@ file, in the current directory or
-- parent directories. If no project file is found then the current dir is the
-- project root (and the project will use an implicit config).
--
findProjectRoot :: InstallFlags -> IO FilePath
findProjectRoot installFlags = do
-- Throws 'BadProjectRoot'.
--
findProjectRoot :: Maybe FilePath -> IO FilePath
findProjectRoot (Just projectFile)
| isAbsolute projectFile = do
exists <- doesFileExist projectFile
if exists
then return (takeDirectory projectFile)
else throwIO (BadProjectRootExplicitFile projectFile)
let projectFileName = getProjectFileName installFlags
findProjectRoot mprojectFile = do
let projectFileName = fromMaybe "cabal.project" mprojectFile
curdir <- getCurrentDirectory
homedir <- getHomeDirectory
......@@ -375,23 +379,45 @@ findProjectRoot installFlags = do
--TODO: [nice to have] add compat support for old style sandboxes
-- | Exception thrown by 'findProjectRoot'.
--
data BadProjectRoot = BadProjectRootExplicitFile FilePath
#if MIN_VERSION_base(4,8,0)
deriving (Show, Typeable)
#else
deriving (Typeable)
instance Show BadProjectRoot where
show = renderBadProjectRoot
#endif
instance Exception BadProjectRoot where
#if MIN_VERSION_base(4,8,0)
displayException = renderBadProjectRoot
#endif
renderBadProjectRoot :: BadProjectRoot -> String
renderBadProjectRoot (BadProjectRootExplicitFile projectFile) =
"The given project file '" ++ projectFile ++ "' does not exist."
-- | Read all the config relevant for a project. This includes the project
-- file if any, plus other global config.
--
readProjectConfig :: Verbosity -> InstallFlags -> FilePath -> Rebuild ProjectConfig
readProjectConfig verbosity installFlags projectRootDir = do
readProjectConfig :: Verbosity -> DistDirLayout -> Rebuild ProjectConfig
readProjectConfig verbosity distDirLayout = do
global <- readGlobalConfig verbosity
local <- readProjectLocalConfig verbosity installFlags projectRootDir
freeze <- readProjectLocalFreezeConfig verbosity installFlags projectRootDir
extra <- readProjectLocalExtraConfig verbosity installFlags projectRootDir
local <- readProjectLocalConfig verbosity distDirLayout
freeze <- readProjectLocalFreezeConfig verbosity distDirLayout
extra <- readProjectLocalExtraConfig verbosity distDirLayout
return (global <> local <> freeze <> extra)
-- | Reads an explicit @cabal.project@ file in the given project root dir,
-- or returns the default project config for an implicitly defined project.
--
readProjectLocalConfig :: Verbosity -> InstallFlags -> FilePath -> Rebuild ProjectConfig
readProjectLocalConfig verbosity installFlags projectRootDir = do
readProjectLocalConfig :: Verbosity -> DistDirLayout -> Rebuild ProjectConfig
readProjectLocalConfig verbosity DistDirLayout{distProjectFile} = do
usesExplicitProjectRoot <- liftIO $ doesFileExist projectFile
if usesExplicitProjectRoot
then do
......@@ -402,7 +428,7 @@ readProjectLocalConfig verbosity installFlags projectRootDir = do
return defaultImplicitProjectConfig
where
projectFile = projectRootDir </> getProjectFileName installFlags
projectFile = distProjectFile ""
readProjectFile =
reportParseResult verbosity "project file" projectFile
. parseProjectConfig
......@@ -430,26 +456,28 @@ readProjectLocalConfig verbosity installFlags projectRootDir = do
-- or returns empty. This file gets written by @cabal configure@, or in
-- principle can be edited manually or by other tools.
--
readProjectLocalExtraConfig :: Verbosity -> InstallFlags -> FilePath -> Rebuild ProjectConfig
readProjectLocalExtraConfig verbosity installFlags =
readProjectExtensionFile verbosity installFlags "local"
readProjectLocalExtraConfig :: Verbosity -> DistDirLayout
-> Rebuild ProjectConfig
readProjectLocalExtraConfig verbosity distDirLayout =
readProjectExtensionFile verbosity distDirLayout "local"
"project local configuration file"
-- | Reads a @cabal.project.freeze@ file in the given project root dir,
-- or returns empty. This file gets written by @cabal freeze@, or in
-- principle can be edited manually or by other tools.
--
readProjectLocalFreezeConfig :: Verbosity -> InstallFlags -> FilePath -> Rebuild ProjectConfig
readProjectLocalFreezeConfig verbosity installFlags =
readProjectExtensionFile verbosity installFlags "freeze"
readProjectLocalFreezeConfig :: Verbosity -> DistDirLayout
-> Rebuild ProjectConfig
readProjectLocalFreezeConfig verbosity distDirLayout =
readProjectExtensionFile verbosity distDirLayout "freeze"
"project freeze file"
-- | Reads a named config file in the given project root dir, or returns empty.
--
readProjectExtensionFile :: Verbosity -> InstallFlags -> String -> FilePath
-> FilePath -> Rebuild ProjectConfig
readProjectExtensionFile verbosity installFlags extensionName extensionDescription
projectRootDir = do
readProjectExtensionFile :: Verbosity -> DistDirLayout -> String -> FilePath
-> Rebuild ProjectConfig
readProjectExtensionFile verbosity DistDirLayout{distProjectFile}
extensionName extensionDescription = do
exists <- liftIO $ doesFileExist extensionFile
if exists
then do monitorFiles [monitorFileHashed extensionFile]
......@@ -457,9 +485,7 @@ readProjectExtensionFile verbosity installFlags extensionName extensionDescripti
else do monitorFiles [monitorNonExistentFile extensionFile]
return mempty
where
extensionFile = projectRootDir </> projectFileName <.> extensionName
projectFileName = getProjectFileName installFlags
extensionFile = distProjectFile extensionName
readExtensionFile =
reportParseResult verbosity extensionDescription extensionFile
......@@ -490,20 +516,16 @@ showProjectConfig =
-- | Write a @cabal.project.local@ file in the given project root dir.
--
writeProjectLocalExtraConfig :: InstallFlags -> FilePath -> ProjectConfig -> IO ()
writeProjectLocalExtraConfig installFlags projectRootDir =
writeProjectConfigFile projectExtraConfigFile
where
projectExtraConfigFile = projectRootDir </> getProjectFileName installFlags <.> "local"
writeProjectLocalExtraConfig :: DistDirLayout -> ProjectConfig -> IO ()
writeProjectLocalExtraConfig DistDirLayout{distProjectFile} =
writeProjectConfigFile (distProjectFile "local")
-- | Write a @cabal.project.freeze@ file in the given project root dir.
--
writeProjectLocalFreezeConfig :: InstallFlags -> FilePath -> ProjectConfig -> IO ()
writeProjectLocalFreezeConfig installFlags projectRootDir =
writeProjectConfigFile projectFreezeConfigFile
where
projectFreezeConfigFile = projectRootDir </> getProjectFileName installFlags <.> "freeze"
writeProjectLocalFreezeConfig :: DistDirLayout -> ProjectConfig -> IO ()
writeProjectLocalFreezeConfig DistDirLayout{distProjectFile} =
writeProjectConfigFile (distProjectFile "freeze")
-- | Write in the @cabal.project@ format to the given file.
......@@ -684,9 +706,10 @@ renderBadPackageLocationMatch bplm = case bplm of
--
-- Throws 'BadPackageLocations'.
--
findProjectPackages :: FilePath -> ProjectConfig
findProjectPackages :: DistDirLayout -> ProjectConfig
-> Rebuild [ProjectPackageLocation]
findProjectPackages projectRootDir ProjectConfig{..} = do
findProjectPackages DistDirLayout{distProjectRootDirectory}
ProjectConfig{..} = do
requiredPkgs <- findPackageLocations True projectPackages
optionalPkgs <- findPackageLocations False projectPackagesOptional
......@@ -777,7 +800,7 @@ findProjectPackages projectRootDir ProjectConfig{..} = do
checkIsSingleFilePackage pkglocstr = do
let filename = projectRootDir </> pkglocstr
let filename = distProjectRootDirectory </> pkglocstr
isFile <- liftIO $ doesFileExist filename
isDir <- liftIO $ doesDirectoryExist filename
if isFile || isDir
......@@ -793,7 +816,7 @@ findProjectPackages projectRootDir ProjectConfig{..} = do
-- The pkglocstr may be absolute or may be relative to the project root.
-- Either way, </> does the right thing here. We return relative paths if
-- they were relative in the first place.
let abspath = projectRootDir </> pkglocstr
let abspath = distProjectRootDirectory </> pkglocstr
isFile <- liftIO $ doesFileExist abspath
isDir <- liftIO $ doesDirectoryExist abspath
parentDirExists <- case takeDirectory abspath of
......
......@@ -276,6 +276,7 @@ convertLegacyAllPackageFlags globalFlags configFlags
} = globalFlags
ConfigFlags {
configDistPref = projectConfigDistDir,
configHcFlavor = projectConfigHcFlavor,
configHcPath = projectConfigHcPath,
configHcPkg = projectConfigHcPkg,
......@@ -294,6 +295,7 @@ convertLegacyAllPackageFlags globalFlags configFlags
} = configExFlags
InstallFlags {
installProjectFileName = projectConfigProjectFile,
installHaddockIndex = projectConfigHaddockIndex,
--installReinstall = projectConfigReinstall,
--installAvoidReinstalls = projectConfigAvoidReinstalls,
......@@ -478,6 +480,7 @@ convertToLegacySharedConfig
configFlags = mempty {
configVerbosity = projectConfigVerbosity,
configDistPref = projectConfigDistDir,
configAllowOlder = projectConfigAllowOlder,
configAllowNewer = projectConfigAllowNewer
}
......@@ -518,7 +521,7 @@ convertToLegacySharedConfig
installKeepGoing = projectConfigKeepGoing,
installRunTests = mempty,
installOfflineMode = projectConfigOfflineMode,
installProjectFileName = mempty
installProjectFileName = projectConfigProjectFile
}
......@@ -816,7 +819,7 @@ legacySharedConfigFieldDescrs =
(fmap unAllowNewer . configAllowNewer)
(\v conf -> conf { configAllowNewer = fmap AllowNewer v })
]
. filterFields ["verbose"]
. filterFields ["verbose", "builddir" ]
. commandOptionsToFields
) (configureOptions ParseArgs)
++
......
......@@ -153,6 +153,8 @@ data ProjectConfigBuildOnly
--
data ProjectConfigShared
= ProjectConfigShared {
projectConfigDistDir :: Flag FilePath,
projectConfigProjectFile :: Flag FilePath,
projectConfigHcFlavor :: Flag CompilerFlavor,
projectConfigHcPath :: Flag FilePath,
projectConfigHcPkg :: Flag FilePath,
......
......@@ -134,7 +134,6 @@ import System.Posix.Signals (sigKILL, sigSEGV)
-- @cabal.project@ and all the local package @.cabal@ files.
--
data ProjectBaseContext = ProjectBaseContext {
projectRootDir :: FilePath,
distDirLayout :: DistDirLayout,
cabalDirLayout :: CabalDirLayout,
projectConfig :: ProjectConfig,
......@@ -144,24 +143,20 @@ data ProjectBaseContext = ProjectBaseContext {
establishProjectBaseContext :: Verbosity
-> ProjectConfig
-> ConfigFlags --TODO: eliminate legacy config type
-> InstallFlags --TODO: eliminate legacy config type
-> IO ProjectBaseContext
establishProjectBaseContext verbosity cliConfig
configFlags installFlags = do
establishProjectBaseContext verbosity cliConfig = do
cabalDir <- defaultCabalDir
projectRootDir <- findProjectRoot
installFlags --TODO: eliminate legacy config type
projectRootDir <- findProjectRoot mprojectFile
let cabalDirLayout = defaultCabalDirLayout cabalDir
distDirLayout = defaultDistDirLayout configFlags --TODO: eliminate legacy config type
projectRootDir
distDirLayout = defaultDistDirLayout projectRootDir
mdistDirectory
mprojectFile
(projectConfig, localPackages) <-
rebuildProjectConfig verbosity
installFlags --TODO: eliminate legacy config type
projectRootDir distDirLayout
distDirLayout
cliConfig
let buildSettings = resolveBuildTimeSettings
......@@ -169,13 +164,20 @@ establishProjectBaseContext verbosity cliConfig
projectConfig
return ProjectBaseContext {
projectRootDir,
distDirLayout,
cabalDirLayout,
projectConfig,
localPackages,
buildSettings
}
where
mdistDirectory = Setup.flagToMaybe projectConfigDistDir
mprojectFile = Setup.flagToMaybe projectConfigProjectFile
ProjectConfigShared {
projectConfigDistDir,
projectConfigProjectFile
} = projectConfigShared cliConfig
-- | This holds the context between the pre-build, build and post-build phases.
--
......@@ -212,7 +214,6 @@ runProjectPreBuildPhase
runProjectPreBuildPhase
verbosity
ProjectBaseContext {
projectRootDir,
distDirLayout,
cabalDirLayout,
projectConfig,
......@@ -226,7 +227,7 @@ runProjectPreBuildPhase
--
(elaboratedPlan, _, elaboratedShared) <-
rebuildInstallPlan verbosity
projectRootDir distDirLayout cabalDirLayout
distDirLayout cabalDirLayout
projectConfig
localPackages
......@@ -317,7 +318,7 @@ runProjectPostBuildPhase verbosity
pkgsBuildStatus
buildOutcomes
writePlanGhcEnvironment projectRootDir
writePlanGhcEnvironment distDirLayout
elaboratedPlanOriginal
elaboratedShared
postBuildStatus
......
......@@ -658,12 +658,12 @@ writePackagesUpToDateCacheFile DistDirLayout{distProjectCacheFile} upToDate =
-- Writing .ghc.environment files
--
writePlanGhcEnvironment :: FilePath
writePlanGhcEnvironment :: DistDirLayout
-> ElaboratedInstallPlan
-> ElaboratedSharedConfig
-> PostBuildProjectStatus
-> IO ()
writePlanGhcEnvironment projectRootDir
writePlanGhcEnvironment DistDirLayout{distProjectRootDirectory}
elaboratedInstallPlan
ElaboratedSharedConfig {
pkgConfigCompiler = compiler,
......@@ -676,9 +676,9 @@ writePlanGhcEnvironment projectRootDir
--TODO: This feature is temporarily disabled due to #4010
, False
= writeGhcEnvironmentFile
projectRootDir
distProjectRootDirectory
platform (compilerVersion compiler)
(renderGhcEnviromentFile projectRootDir
(renderGhcEnviromentFile distProjectRootDirectory
elaboratedInstallPlan
postBuildStatus)
--TODO: [required eventually] support for writing user-wide package
......
......@@ -290,15 +290,12 @@ sanityCheckElaboratedPackage ElaboratedConfiguredPackage{..}
-- packages within the project.
--
rebuildProjectConfig :: Verbosity
-> InstallFlags --TODO: eliminate
-> FilePath
-> DistDirLayout
-> ProjectConfig
-> IO (ProjectConfig, [UnresolvedSourcePackage])
rebuildProjectConfig verbosity
installFlags
projectRootDir
DistDirLayout {
distDirLayout@DistDirLayout {