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 @@ -853,14 +853,21 @@ readProjectFileSkeletonGen
853853 exists <- liftIO $ doesFileExist extensionFile
854854 if exists
855855 then do
856- monitorFiles [monitorFileHashed extensionFile]
857856 pcs <- liftIO $ parseConfig extensionFile
858- monitorFiles $ map monitorFileHashed (projectConfigPathRoot <$> projectSkeletonImports pcs)
857+
858+ -- we need to monitor the main project file as well as all (possibly recursive) imports
859+ let allProjectFiles = map makeAbsolute . nub . concat $ projectConfigPathAll <$> projectSkeletonImports pcs
860+ monitorFiles $ map monitorFileHashed allProjectFiles
861+
859862 return pcs
860863 else do
861864 monitorFiles [monitorNonExistentFile extensionFile]
862865 return mempty
863866 where
867+ -- do we prefer absolute paths for cache monitoring?
868+ makeAbsolute f
869+ | isAbsolute f = f
870+ | otherwise = distProjectRootDirectory dir </> f
864871 extensionFile = (distProjectFile dir) extensionName
865872
866873-- There are 3 different variants of the project parsing function.
You can’t perform that action at this time.
0 commit comments