Skip to content

Commit bdcf9aa

Browse files
committed
WIP: first steps
1 parent d643706 commit bdcf9aa

File tree

206 files changed

+51
-942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+51
-942
lines changed

cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module Distribution.Solver.Types.ProjectConfigPath
1616
, cyclicalImportMsg
1717
, untrimmedUriImportMsg
1818
, docProjectConfigPathFailReason
19+
, quoteUntrimmed
1920

2021
-- * Checks and Normalization
2122
, isCyclicConfigPath

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ import qualified Data.Map as Map
231231
import qualified Data.Set as Set
232232
import Distribution.Client.Errors
233233
import Distribution.Solver.Types.ProjectConfigPath
234+
import System.Directory (getCurrentDirectory)
234235
import System.FilePath
235236
import qualified Text.PrettyPrint as Disp
236237

@@ -407,13 +408,7 @@ rebuildProjectConfig
407408
localPackages <- phaseReadLocalPackages compiler (projectConfig <> cliConfig)
408409
return (projectConfig, localPackages)
409410

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

418413
return (projectConfig <> cliConfig, localPackages)
419414
where
@@ -460,6 +455,47 @@ rebuildProjectConfig
460455
projectConfigBuildOnly
461456
pkgLocations
462457

458+
informAboutConfigFiles projectConfig = do
459+
cwd <- getCurrentDirectory
460+
let out -- output mode is verbose ('notice') if we build outside the project root
461+
| cwd == distProjectRootDirectory = info
462+
| otherwise = notice
463+
unless (null configFiles)
464+
. out (verboseStderr verbosity)
465+
. render
466+
$ message
467+
where
468+
-- message formatting depends on |config files| (the number of config files)
469+
message = case configFilesDoc of
470+
(_ : _ : _ : _) ->
471+
-- \|config files| > 2 => vertical list
472+
vcat
473+
[ affectedByMsg <> text "the following files:"
474+
, configFilesVertList
475+
, atProjectRootMsg
476+
]
477+
[path1, path2] ->
478+
affectedByMsg <> path1 <> text " and " <> (path2 <+> atProjectRootMsg)
479+
[path] ->
480+
affectedByMsg <> (path <+> atProjectRootMsg)
481+
[] ->
482+
error "impossible" -- see `unless (null configFiles)` above
483+
where
484+
configFilesDoc = map (quoteUntrimmed . projectConfigPathRoot) configFiles
485+
configFilesVertList -- if verbose, include provenance ("imported by" stuff)
486+
| verbosity < verbose = docProjectConfigFiles configFiles
487+
| otherwise = vcat $ map (\p -> text "- " <> docProjectConfigPath p) configFiles
488+
affectedByMsg = text "Configuration is affected by "
489+
atProjectRootMsg = text "at '" <> text distProjectRootDirectory <> text "'."
490+
491+
configFiles =
492+
[ path
493+
| Explicit path <-
494+
Set.toList
495+
. (if verbosity >= verbose then id else onlyTopLevelProvenance)
496+
$ projectConfigProvenance projectConfig
497+
]
498+
463499
configureCompiler
464500
:: Verbosity
465501
-> DistDirLayout

cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external-target.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.external.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.external.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.internal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.internal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/Backpack/Includes2/cov.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal test
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.out

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.external.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:
@@ -16,7 +14,8 @@ Configuring library for indef-0.1.0.0...
1614
Preprocessing library for indef-0.1.0.0...
1715
Building library instantiated with Data.Map = <Data.Map>
1816
for indef-0.1.0.0...
19-
Configuring library instantiated with Data.Map = containers-<VERSION>:Data.Map
17+
Configuring library instantiated with
18+
Data.Map = containers-<VERSION>:Data.Map
2019
for indef-0.1.0.0...
2120
Preprocessing library for indef-0.1.0.0...
2221
Building library instantiated with Data.Map = containers-<VERSION>:Data.Map

cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.internal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:
@@ -20,7 +18,8 @@ Configuring library 'indef' instantiated with
2018
Data.Map = containers-<VERSION>:Data.Map
2119
for I-0.1.0.0...
2220
Preprocessing library 'indef' for I-0.1.0.0...
23-
Building library 'indef' instantiated with Data.Map = containers-<VERSION>:Data.Map
21+
Building library 'indef' instantiated with
22+
Data.Map = containers-<VERSION>:Data.Map
2423
for I-0.1.0.0...
2524
Configuring executable 'exe' for I-0.1.0.0...
2625
Preprocessing executable 'exe' for I-0.1.0.0...

cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.out

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# cabal v2-update
2-
Configuration is affected by the following files:
3-
- cabal.repo.project
42
Downloading the latest package list from test-local-repo
53
# cabal v2-build
6-
Configuration is affected by the following files:
7-
- cabal.repo.project
84
Resolving dependencies...
95
Build profile: -w ghc-<GHCVER> -O1
106
In order, the following will be built:
@@ -22,7 +18,8 @@ Preprocessing library for indef-0.1.0.0...
2218
Building library instantiated with Data.Map = <Data.Map>
2319
for indef-0.1.0.0...
2420
Installing library in <PATH>
25-
Configuring library instantiated with Data.Map = containers-<VERSION>:Data.Map
21+
Configuring library instantiated with
22+
Data.Map = containers-<VERSION>:Data.Map
2623
for indef-0.1.0.0...
2724
Preprocessing library for indef-0.1.0.0...
2825
Building library instantiated with Data.Map = containers-<VERSION>:Data.Map

cabal-testsuite/PackageTests/Backpack/Reexport2/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Error:
64
Problem with module re-exports:

cabal-testsuite/PackageTests/Backpack/T6385/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# cabal v2-update
22
Downloading the latest package list from test-local-repo
33
# cabal v2-build
4-
Configuration is affected by the following files:
5-
- cabal.project
64
Resolving dependencies...
75
Build profile: -w ghc-<GHCVER> -O1
86
In order, the following will be built:

cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/BuildAutogenPackageGuard/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/BuildDeps/DepCycle/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Error:
64
Dependency cycle between the following components:

cabal-testsuite/PackageTests/BuildDeps/InternalLibrary1/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/BuildTargets/UseLocalPackage/use-local-version-of-package.out

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# cabal v2-update
22
Downloading the latest package list from test-local-repo
33
# cabal v2-build
4-
Configuration is affected by the following files:
5-
- cabal.project
64
Resolving dependencies...
75
Build profile: -w ghc-<GHCVER> -O1
86
In order, the following will be built:
@@ -13,8 +11,6 @@ Building executable 'my-exe' for pkg-1.0...
1311
# pkg my-exe
1412
local pkg-1.0
1513
# cabal v2-build
16-
Configuration is affected by the following files:
17-
- cabal.project
1814
Resolving dependencies...
1915
Error: [Cabal-7107]
2016
Could not resolve dependencies:

cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/use-local-package-as-setup-dep.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# cabal v2-update
22
Downloading the latest package list from test-local-repo
33
# cabal v2-build
4-
Configuration is affected by the following files:
5-
- cabal.project
64
Resolving dependencies...
75
Error: [Cabal-7107]
86
Could not resolve dependencies:

cabal-testsuite/PackageTests/BuildToolDepends/setup.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/BuildToolDependsExternal/setup.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/BuildTools/External/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/BuildTools/Internal/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-build
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/CmmSources/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-run
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-run
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# cabal v2-run
2-
Configuration is affected by the following files:
3-
- cabal.project
42
Resolving dependencies...
53
Build profile: -w ghc-<GHCVER> -O1
64
In order, the following will be built:

0 commit comments

Comments
 (0)