File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
cabal-install-solver/src/Distribution/Solver/Types
cabal-install/src/Distribution/Client Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ module Distribution.Solver.Types.ProjectConfigPath
16
16
17
17
-- * Checks and Normalization
18
18
, isCyclicConfigPath
19
+ , isTopLevelConfigPath
19
20
, canonicalizeConfigPath
20
21
) where
21
22
@@ -138,6 +139,11 @@ nullProjectConfigPath = ProjectConfigPath $ "unused" :| []
138
139
isCyclicConfigPath :: ProjectConfigPath -> Bool
139
140
isCyclicConfigPath (ProjectConfigPath p) = length p /= length (NE. nub p)
140
141
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
+
141
147
-- | Prepends the path of the importee to the importer path.
142
148
consProjectConfigPath :: FilePath -> ProjectConfigPath -> ProjectConfigPath
143
149
consProjectConfigPath p ps = ProjectConfigPath (p <| coerce ps)
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ module Distribution.Client.ProjectConfig
37
37
, writeProjectLocalFreezeConfig
38
38
, writeProjectConfigFile
39
39
, commandLineFlagsToProjectConfig
40
+ , onlyTopLevelProvenance
40
41
41
42
-- * Packages within projects
42
43
, ProjectPackageLocation (.. )
@@ -1753,3 +1754,9 @@ checkBadPerPackageCompilerPaths compilerPrograms packagesConfig =
1753
1754
] of
1754
1755
[] -> return ()
1755
1756
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
Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ rebuildProjectConfig
401
401
notice (verboseStderr verbosity) . render . vcat $
402
402
text " Configuration is affected by the following files:"
403
403
: [ text " -" <+> docProjectConfigPath path
404
- | Explicit path <- Set. toList $ projectConfigProvenance projectConfig
404
+ | Explicit path <- Set. toList . onlyTopLevelProvenance $ projectConfigProvenance projectConfig
405
405
]
406
406
407
407
return (projectConfig <> cliConfig, localPackages)
You can’t perform that action at this time.
0 commit comments