Commit 5afa3624 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by GitHub
Browse files

Merge pull request #4460 from pranitbauva1997/display-old-config

Output old config before rewriting `cabal.project.local`
parents c36aff19 ceb466b2
......@@ -5,6 +5,9 @@ module Distribution.Client.CmdConfigure (
configureAction,
) where
import System.Directory
import Control.Monad
import Distribution.Client.ProjectOrchestration
import Distribution.Client.ProjectConfig
( writeProjectLocalExtraConfig )
......@@ -19,7 +22,7 @@ import Distribution.Verbosity
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Simple.Utils
( wrapText )
( wrapText, notice )
import qualified Distribution.Client.Setup as Client
configureCommand :: CommandUI (ConfigFlags, ConfigExFlags
......@@ -83,7 +86,12 @@ configureAction (configFlags, configExFlags, installFlags, haddockFlags)
baseCtx <- establishProjectBaseContext verbosity cliConfig
-- Write out the @cabal.project.local@ so it gets picked up by the
-- planning phase.
-- planning phase. If old config exists, then print the contents
-- before overwriting
exists <- doesFileExist "cabal.project.local"
when exists $ do
notice verbosity "'cabal.project.local' file already exists. Now overwriting it."
copyFile "cabal.project.local" "cabal.project.local~"
writeProjectLocalExtraConfig (distDirLayout baseCtx)
cliConfig
......
name: NewConfigure
version: 0.1.0.0
author: Foo Bar
maintainer: cabal-dev@haskell.org
build-type: Simple
cabal-version: >=1.10
library
exposed-modules: Foo
build-depends: base
default-language: Haskell2010
# cabal new-configure
'cabal.project.local' file already exists. Now overwriting it.
Resolving dependencies...
In order, the following would be built:
- NewConfigure-0.1.0.0 (lib) (first run)
import Test.Cabal.Prelude
main = cabalTest $
withSourceCopy $ do
r <- cabal' "new-configure" []
assertOutputContains "Now overwriting it" r
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