Skip to content

Commit

Permalink
don't print anything when provenance is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses4ever committed Nov 12, 2024
1 parent 3135148 commit f96907b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions cabal-install/src/Distribution/Client/ProjectConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module Distribution.Client.ProjectConfig
, writeProjectConfigFile
, commandLineFlagsToProjectConfig
, onlyTopLevelProvenance
, noProjectConfigProvenance

-- * Packages within projects
, ProjectPackageLocation (..)
Expand Down Expand Up @@ -1760,3 +1761,7 @@ onlyTopLevelProvenance :: Set ProjectConfigProvenance -> Set ProjectConfigProven
onlyTopLevelProvenance = Set.filter $ \case
Implicit -> False
Explicit ps -> isTopLevelConfigPath ps

-- | No explicit project config was found
noProjectConfigProvenance :: ProjectConfig -> Bool
noProjectConfigProvenance (ProjectConfig{projectConfigProvenance = prov}) = Set.null prov
11 changes: 6 additions & 5 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,12 @@ rebuildProjectConfig
localPackages <- phaseReadLocalPackages (projectConfig <> cliConfig)
return (projectConfig, localPackages)

notice (verboseStderr verbosity) . render . vcat $
text "Configuration is affected by the following files:"
: [ text "-" <+> docProjectConfigPath path
| Explicit path <- Set.toList . (if verbosity >= verbose then id else onlyTopLevelProvenance) $ projectConfigProvenance projectConfig
]
unless (noProjectConfigProvenance projectConfig) $
notice (verboseStderr verbosity) . render . vcat $
text "Configuration is affected by the following files:"
: [ text "-" <+> docProjectConfigPath path
| Explicit path <- Set.toList . (if verbosity >= verbose then id else onlyTopLevelProvenance) $ projectConfigProvenance projectConfig
]

return (projectConfig <> cliConfig, localPackages)
where
Expand Down

0 comments on commit f96907b

Please sign in to comment.