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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
51 changes: 44 additions & 7 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ import Control.Monad.IO.Class (liftIO)
import Control.Monad.State as State (State, execState, runState, state)
import Data.Foldable (fold)
import Data.List (deleteBy, groupBy)
import qualified Data.List as L
import qualified Data.List.NonEmpty as NE
import qualified Data.Map as Map
import qualified Data.Set as Set
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,48 @@ rebuildProjectConfig
projectConfigBuildOnly
pkgLocations

informAboutConfigFiles projectConfig =
unless (null configFiles)
. out (verboseStderr verbosity)
. render
$ message
where
-- output mode is either 'notice' or 'info' depending on how trivial the information
out
| allProjectFilesInCWD = info
| otherwise = notice
where
allProjectFilesInCWD =
map projectConfigPathRoot configFiles
L.\\ ["cabal.project", "cabal.project.local", "cabal.freeze"]
== []

-- formatting depends on |config files| (the number of config files)
message = case configFilesDoc of
(_ : _ : _ : _) ->
-- \|config files| > 2 => vertical list
text "Configuration is affected by the following files:" <+> configFilesVertList
[path1, path2] ->
text "Configuration is affected by '" <+> path1 <+> text "' and '" <+> path2 <+> text "'"
[path] ->
text
"Configuration is affected by '"
<+> path
<+> text "'"
[] ->
error "impossible" -- see `unless (null configFiles)` above
where
configFilesDoc = map docProjectConfigPath configFiles
configFilesVertList = docProjectConfigFiles configFiles

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,5 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.external.project
Configuration is affected by ' 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,5 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.external.project
Configuration is affected by ' 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,5 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.internal.project
Configuration is affected by ' 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,5 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.internal.project
Configuration is affected by ' 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,5 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.external.project
Configuration is affected by ' cabal.external.project '
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand All @@ -16,7 +15,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,5 @@
# cabal v2-build
Configuration is affected by the following files:
- cabal.internal.project
Configuration is affected by ' cabal.internal.project '
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand All @@ -20,7 +19,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,8 @@
# cabal v2-update
Configuration is affected by the following files:
- cabal.repo.project
Configuration is affected by ' 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
Configuration is affected by ' cabal.repo.project '
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
Expand All @@ -22,7 +20,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
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/ConfigFile/T8487/cabal.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cabal build
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O2
In order, the following will be built:
Expand Down
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/CopyHie/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/CustomSegfault/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
8 changes: 3 additions & 5 deletions cabal-testsuite/PackageTests/CustomTestCoverage/cabal.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 All @@ -13,7 +11,7 @@ Building test suite 'test' for plain-0.1.0.0...
Running 1 test suites...
Test suite test: RUNNING...
Test suite test: PASS
Test suite logged to: <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/test/plain-0.1.0.0-test.log
Package coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/hpc_index.html
Test suite logged to: cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/test/plain-0.1.0.0-test.log
Package coverage report written to cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/hpc_index.html
1 of 1 test suites (1 of 1 test cases) passed.
Package coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/hpc_index.html
Package coverage report written to cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/hpc_index.html
2 changes: 0 additions & 2 deletions cabal-testsuite/PackageTests/CustomWithoutCabal/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/Exec/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/ExecModern/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/ExternalCommand/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/ExternalCommandEnv/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/ExternalCommandHelp/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/ExtraPackages/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-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