File tree Expand file tree Collapse file tree
cabal-install-solver/src/Distribution/Solver/Types
cabal-install/src/Distribution/Client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module Distribution.Solver.Types.ProjectConfigPath
66 -- * Project Config Path Manipulation
77 ProjectConfigPath (.. )
88 , projectConfigPathRoot
9+ , projectConfigPathAll
910 , nullProjectConfigPath
1011 , consProjectConfigPath
1112 , unconsProjectConfigPath
@@ -217,6 +218,10 @@ docProjectConfigPathFailReason vr pcp
217218projectConfigPathRoot :: ProjectConfigPath -> FilePath
218219projectConfigPathRoot (ProjectConfigPath xs) = last xs
219220
221+ -- | Get all paths.
222+ projectConfigPathAll :: ProjectConfigPath -> [FilePath ]
223+ projectConfigPathAll (ProjectConfigPath xs) = NE. toList xs
224+
220225-- | Used by some tests as a dummy "unused" project root.
221226nullProjectConfigPath :: ProjectConfigPath
222227nullProjectConfigPath = ProjectConfigPath $ " unused" :| []
Original file line number Diff line number Diff line change @@ -830,14 +830,21 @@ readProjectFileSkeletonGen
830830 exists <- liftIO $ doesFileExist extensionFile
831831 if exists
832832 then do
833- monitorFiles [monitorFileHashed extensionFile]
834833 pcs <- liftIO $ parseConfig extensionFile
835- monitorFiles $ map monitorFileHashed (projectConfigPathRoot <$> projectSkeletonImports pcs)
834+
835+ -- we need to monitor the main project file as well as all (possibly recursive) imports
836+ let allProjectFiles = map makeAbsolute . nub . concatMap projectConfigPathAll $ projectSkeletonImports pcs
837+ monitorFiles $ map monitorFileHashed allProjectFiles
838+
836839 return pcs
837840 else do
838841 monitorFiles [monitorNonExistentFile extensionFile]
839842 return mempty
840843 where
844+ -- do we prefer absolute paths for cache monitoring?
845+ makeAbsolute f
846+ | isAbsolute f = f
847+ | otherwise = distProjectRootDirectory dir </> f
841848 extensionFile = (distProjectFile dir) extensionName
842849
843850-- There are 3 different variants of the project parsing function.
You can’t perform that action at this time.
0 commit comments