@@ -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,42 @@ 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+ vcat $
471+ -- \|config files| > 2 => vertical list
472+ text " Configuration is affected by the following files:" : configFilesVertList
473+ [path1, path2] ->
474+ text " Configuration is affected by '" <+> path1 <+> text " ' and '" <+> path2 <+> text " '"
475+ [path] ->
476+ mempty -- TODO
477+ text
478+ " Configuration is affected by '"
479+ <+> path
480+ <+> text " '"
481+ where
482+ configFilesDoc = docProjectConfigFiles configFiles
483+ configFilesVertList = map (text " -" <+> ) configFilesDoc
484+
485+ configFiles =
486+ [ path
487+ | Explicit path <-
488+ Set. toList
489+ . (if verbosity >= verbose then id else onlyTopLevelProvenance)
490+ $ projectConfigProvenance projectConfig
491+ ]
492+
463493configureCompiler
464494 :: Verbosity
465495 -> DistDirLayout
0 commit comments