Commit 4c7f9356 authored by Edward Z. Yang's avatar Edward Z. Yang

Make --builddir/--distdir/etc affect dist-newstyle.

Previously, these flags had no affect on new-build.
Now, they let you specify where the dist-newstyle directory
should go.

Note that if a relative path is provided, it is resolved
relative to the *project root*.  If this is undesirable,
pass an absolute path instead.

Fixes #4127.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 3b8589f1
......@@ -87,7 +87,7 @@ freezeAction (configFlags, configExFlags, installFlags, haddockFlags)
let cabalDirLayout = defaultCabalDirLayout cabalDir
projectRootDir <- findProjectRoot
let distDirLayout = defaultDistDirLayout projectRootDir
let distDirLayout = defaultDistDirLayout configFlags projectRootDir
let cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
......
......@@ -17,6 +17,7 @@ module Distribution.Client.DistDirLayout (
) where
import System.FilePath
import Distribution.Simple.Setup (fromFlagOrDefault, ConfigFlags, configDistPref)
import Distribution.Package
( PackageId, ComponentId, UnitId )
import Distribution.Compiler
......@@ -106,12 +107,14 @@ data CabalDirLayout = CabalDirLayout {
cabalWorldFile :: FilePath
}
defaultDistDirLayout :: FilePath -> DistDirLayout
defaultDistDirLayout projectRootDirectory =
-- | Given the path to the root directory, create the 'DistDirLayout'
-- associated with it. Respects @--builddir@ setting.
defaultDistDirLayout :: ConfigFlags -> FilePath -> DistDirLayout
defaultDistDirLayout configFlags projectRootDirectory =
DistDirLayout {..}
where
distDirectory = projectRootDirectory </> "dist-newstyle"
distDirName = fromFlagOrDefault "dist-newstyle" (configDistPref configFlags)
distDirectory = projectRootDirectory </> distDirName
--TODO: switch to just dist at some point, or some other new name
distBuildRootDirectory = distDirectory </> "build"
......
......@@ -173,7 +173,7 @@ runProjectPreBuildPhase
let cabalDirLayout = defaultCabalDirLayout cabalDir
projectRootDir <- findProjectRoot
let distDirLayout = defaultDistDirLayout projectRootDir
let distDirLayout = defaultDistDirLayout configFlags projectRootDir
let cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
......
......@@ -249,7 +249,7 @@ planProject testdir cliConfig = do
projectRootDir <- canonicalizePath ("tests" </> "IntegrationTests2"
</> testdir)
let distDirLayout = defaultDistDirLayout projectRootDir
let distDirLayout = defaultDistDirLayout mempty projectRootDir
-- Clear state between test runs. The state remains if the previous run
-- ended in an exception (as we leave the files to help with debugging).
......@@ -313,7 +313,7 @@ cleanProject testdir = do
when alreadyExists $ removeDirectoryRecursive distDir
where
projectRootDir = "tests" </> "IntegrationTests2" </> testdir
distDirLayout = defaultDistDirLayout projectRootDir
distDirLayout = defaultDistDirLayout mempty projectRootDir
distDir = distDirectory distDirLayout
......
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