Skip to content

Commit d2194da

Browse files
committed
WIP: first steps
1 parent 04ab16c commit d2194da

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

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

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,8 @@ 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
417-
410+
informAboutConfigFiles projectConfig
411+
418412
return (projectConfig <> cliConfig, localPackages)
419413
where
420414
ProjectConfigShared{projectConfigHcFlavor, projectConfigHcPath, projectConfigHcPkg, projectConfigIgnoreProject, projectConfigConfigFile} =
@@ -460,6 +454,37 @@ rebuildProjectConfig
460454
projectConfigBuildOnly
461455
pkgLocations
462456

457+
informAboutConfigFiles projectConfig =
458+
unless (null configFiles) $
459+
log (verboseStderr verbosity) . render $ message
460+
where
461+
462+
log | allProjectFilesInCWD = info
463+
| otherwise = notice
464+
where
465+
allProjectFilesInCWD = False -- TODO
466+
467+
message | length configFilesDoc > 2 = vcat $
468+
text "Configuration is affected by the following files:" : configFilesDoc
469+
470+
| [path1, path2] <- configFilesDoc =
471+
text "Configuration is affected by the files '" <+> path1 <+> text "' and '" <+> path2 <+> text "'"
472+
473+
| [path] <- configFilesDoc = mempty
474+
475+
configFilesDoc =
476+
map (\path ->
477+
text "-" <+> docProjectConfigPath path)
478+
configFiles
479+
480+
configFiles =
481+
[ path
482+
| Explicit path
483+
<- Set.toList
484+
. (if verbosity >= verbose then id else onlyTopLevelProvenance) $ projectConfigProvenance projectConfig
485+
]
486+
487+
463488
configureCompiler
464489
:: Verbosity
465490
-> DistDirLayout

0 commit comments

Comments
 (0)