Skip to content

Commit 6ff627c

Browse files
committed
only report top-level project config files
1 parent db8e6b4 commit 6ff627c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module Distribution.Solver.Types.ProjectConfigPath
1616

1717
-- * Checks and Normalization
1818
, isCyclicConfigPath
19+
, isTopLevelConfigPath
1920
, canonicalizeConfigPath
2021
) where
2122

@@ -138,6 +139,11 @@ nullProjectConfigPath = ProjectConfigPath $ "unused" :| []
138139
isCyclicConfigPath :: ProjectConfigPath -> Bool
139140
isCyclicConfigPath (ProjectConfigPath p) = length p /= length (NE.nub p)
140141

142+
-- | Check if the project config path is top-level, meaning it was not included by
143+
-- some other project config.
144+
isTopLevelConfigPath :: ProjectConfigPath -> Bool
145+
isTopLevelConfigPath (ProjectConfigPath p) = NE.length p == 1
146+
141147
-- | Prepends the path of the importee to the importer path.
142148
consProjectConfigPath :: FilePath -> ProjectConfigPath -> ProjectConfigPath
143149
consProjectConfigPath p ps = ProjectConfigPath (p <| coerce ps)

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module Distribution.Client.ProjectConfig
3737
, writeProjectLocalFreezeConfig
3838
, writeProjectConfigFile
3939
, commandLineFlagsToProjectConfig
40+
, onlyTopLevelProvenance
4041

4142
-- * Packages within projects
4243
, ProjectPackageLocation (..)
@@ -1753,3 +1754,9 @@ checkBadPerPackageCompilerPaths compilerPrograms packagesConfig =
17531754
] of
17541755
[] -> return ()
17551756
ps -> throwIO (BadPerPackageCompilerPaths ps)
1757+
1758+
-- | Filter out non-top-level project configs
1759+
onlyTopLevelProvenance :: Set ProjectConfigProvenance -> Set ProjectConfigProvenance
1760+
onlyTopLevelProvenance = Set.filter $ \case
1761+
Implicit -> False
1762+
Explicit ps -> isTopLevelConfigPath ps

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ rebuildProjectConfig
401401
notice (verboseStderr verbosity) . render . vcat $
402402
text "Configuration is affected by the following files:"
403403
: [ text "-" <+> docProjectConfigPath path
404-
| Explicit path <- Set.toList $ projectConfigProvenance projectConfig
404+
| Explicit path <- Set.toList . onlyTopLevelProvenance $ projectConfigProvenance projectConfig
405405
]
406406

407407
return (projectConfig <> cliConfig, localPackages)

0 commit comments

Comments
 (0)