Skip to content

Commit cc63eaf

Browse files
committed
WIP: first steps
1 parent 2b0ccee commit cc63eaf

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

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

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,7 @@ rebuildProjectConfig
407407
localPackages <- phaseReadLocalPackages compiler (projectConfig <> cliConfig)
408408
return (projectConfig, localPackages)
409409

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
410+
informAboutConfigFiles projectConfig
417411

418412
return (projectConfig <> cliConfig, localPackages)
419413
where
@@ -460,6 +454,40 @@ rebuildProjectConfig
460454
projectConfigBuildOnly
461455
pkgLocations
462456

457+
informAboutConfigFiles projectConfig =
458+
unless (null configFiles) .
459+
out (verboseStderr verbosity) . render $
460+
message
461+
where
462+
-- output mode is either 'notice' or 'info' depending on how trivial the information
463+
out
464+
| allProjectFilesInCWD = info
465+
| otherwise = notice
466+
where
467+
allProjectFilesInCWD = False -- TODO
468+
message = case configFilesDoc of -- formatting depends on |config files| (the number of config files)
469+
(_ : _ : _ : _) ->
470+
-- \|config files| > 2 => vertical list
471+
text "Configuration is affected by the following files:" <+> configFilesVertList
472+
[path1, path2] ->
473+
text "Configuration is affected by '" <+> path1 <+> text "' and '" <+> path2 <+> text "'"
474+
[path] ->
475+
text
476+
"Configuration is affected by '"
477+
<+> path
478+
<+> text "'"
479+
where
480+
configFilesDoc = map docProjectConfigPath configFiles
481+
configFilesVertList = docProjectConfigFiles configFiles
482+
483+
configFiles =
484+
[ path
485+
| Explicit path <-
486+
Set.toList
487+
. (if verbosity >= verbose then id else onlyTopLevelProvenance)
488+
$ projectConfigProvenance projectConfig
489+
]
490+
463491
configureCompiler
464492
:: Verbosity
465493
-> DistDirLayout

0 commit comments

Comments
 (0)