Skip to content

make cabal less chatty w.r.t. project files in use #10940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module Distribution.Solver.Types.ProjectConfigPath
, cyclicalImportMsg
, untrimmedUriImportMsg
, docProjectConfigPathFailReason
, quoteUntrimmed

-- * Checks and Normalization
, isCyclicConfigPath
Expand Down
50 changes: 43 additions & 7 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ import qualified Data.Map as Map
import qualified Data.Set as Set
import Distribution.Client.Errors
import Distribution.Solver.Types.ProjectConfigPath
import System.Directory (getCurrentDirectory)
import System.FilePath
import qualified Text.PrettyPrint as Disp

Expand Down Expand Up @@ -407,13 +408,7 @@ rebuildProjectConfig
localPackages <- phaseReadLocalPackages compiler (projectConfig <> cliConfig)
return (projectConfig, localPackages)

let configfiles =
[ text "-" <+> docProjectConfigPath path
| Explicit path <- Set.toList . (if verbosity >= verbose then id else onlyTopLevelProvenance) $ projectConfigProvenance projectConfig
]
unless (null configfiles) $
notice (verboseStderr verbosity) . render . vcat $
text "Configuration is affected by the following files:" : configfiles
informAboutConfigFiles projectConfig

return (projectConfig <> cliConfig, localPackages)
where
Expand Down Expand Up @@ -460,6 +455,47 @@ rebuildProjectConfig
projectConfigBuildOnly
pkgLocations

informAboutConfigFiles projectConfig = do
cwd <- getCurrentDirectory
let out -- output mode is verbose ('notice') if we build outside the project root
| cwd == distProjectRootDirectory = info
| otherwise = notice
unless (null configFiles)
. out (verboseStderr verbosity)
. render
$ message
where
-- message formatting depends on |config files| (the number of config files)
message = case configFilesDoc of
(_ : _ : _ : _) ->
-- \|config files| > 2 => vertical list
vcat
[ affectedByMsg <> text "the following files:"
, configFilesVertList
, atProjectRootMsg
]
[path1, path2] ->
affectedByMsg <> path1 <> text " and " <> (path2 <+> atProjectRootMsg)
[path] ->
affectedByMsg <> (path <+> atProjectRootMsg)
[] ->
error "impossible" -- see `unless (null configFiles)` above
where
configFilesDoc = map (quoteUntrimmed . projectConfigPathRoot) configFiles
configFilesVertList -- if verbose, include provenance ("imported by" stuff)
| verbosity < verbose = docProjectConfigFiles configFiles
| otherwise = vcat $ map (\p -> text "- " <> docProjectConfigPath p) configFiles
affectedByMsg = text "Configuration is affected by "
atProjectRootMsg = text "at '" <> text distProjectRootDirectory <> text "'."

configFiles =
[ path
| Explicit path <-
Set.toList
. (if verbosity >= verbose then id else onlyTopLevelProvenance)
$ projectConfigProvenance projectConfig
]

configureCompiler
:: Verbosity
-> DistDirLayout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.external.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.external.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.internal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.internal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/Backpack/Includes2/cov.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal test
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.external.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand All @@ -16,7 +14,8 @@ Configuring library for indef-0.1.0.0...
Preprocessing library for indef-0.1.0.0...
Building library instantiated with Data.Map = <Data.Map>
for indef-0.1.0.0...
Configuring library instantiated with Data.Map = containers-<VERSION>:Data.Map
Configuring library instantiated with
Data.Map = containers-<VERSION>:Data.Map
for indef-0.1.0.0...
Preprocessing library for indef-0.1.0.0...
Building library instantiated with Data.Map = containers-<VERSION>:Data.Map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.internal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand All @@ -20,7 +18,8 @@ Configuring library 'indef' instantiated with
Data.Map = containers-<VERSION>:Data.Map
for I-0.1.0.0...
Preprocessing library 'indef' for I-0.1.0.0...
Building library 'indef' instantiated with Data.Map = containers-<VERSION>:Data.Map
Building library 'indef' instantiated with
Data.Map = containers-<VERSION>:Data.Map
for I-0.1.0.0...
Configuring executable 'exe' for I-0.1.0.0...
Preprocessing executable 'exe' for I-0.1.0.0...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# cabal v2-update
Configuration is affected by the following files:
- cabal.repo.project
Downloading the latest package list from test-local-repo
# cabal v2-build
Configuration is affected by the following files:
- cabal.repo.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand All @@ -22,7 +18,8 @@ Preprocessing library for indef-0.1.0.0...
Building library instantiated with Data.Map = <Data.Map>
for indef-0.1.0.0...
Installing library in <PATH>
Configuring library instantiated with Data.Map = containers-<VERSION>:Data.Map
Configuring library instantiated with
Data.Map = containers-<VERSION>:Data.Map
for indef-0.1.0.0...
Preprocessing library for indef-0.1.0.0...
Building library instantiated with Data.Map = containers-<VERSION>:Data.Map
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/Backpack/Reexport2/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Error:
Problem with module re-exports:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/Backpack/T6385/cabal.out
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/BuildDeps/DepCycle/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Error:
Dependency cycle between the following components:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand All @@ -13,8 +11,6 @@ Building executable 'my-exe' for pkg-1.0...
# pkg my-exe
local pkg-1.0
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/BuildToolDepends/setup.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/BuildTools/External/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/BuildTools/Internal/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/CmmSources/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-run
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-run
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal v2-run
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand Down
Loading
Loading