@@ -472,7 +472,7 @@ rawDependencyInformation fs = do
472472reportImportCyclesRule :: Recorder (WithPriority Log ) -> Rules ()
473473reportImportCyclesRule recorder =
474474 defineEarlyCutoff (cmapWithPrio LogShake recorder) $ Rule $ \ ReportImportCycles file -> fmap (\ errs -> if null errs then (Just " 1" ,([] , Just () )) else (Nothing , (errs, Nothing ))) $ do
475- DependencyInformation {.. } <- useWithSeparateFingerprintRule_ GetFileModuleGraphFingerprint GetModuleGraph file
475+ DependencyInformation {.. } <- useWithSeparateFingerprintRule_ GetModuleGraphTransDepsFingerprints GetModuleGraph file
476476 case pathToId depPathIdMap file of
477477 -- The header of the file does not parse, so it can't be part of any import cycles.
478478 Nothing -> pure []
@@ -628,12 +628,6 @@ getModuleGraphRule recorder = defineEarlyCutOffNoFile (cmapWithPrio LogShake rec
628628 fs <- toKnownFiles <$> useNoFile_ GetKnownTargets
629629 dependencyInfoForFiles (HashSet. toList fs)
630630
631- getModuleGraphSingleFileRule :: Recorder (WithPriority Log ) -> Rules ()
632- getModuleGraphSingleFileRule recorder =
633- defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \ GetFileModuleGraphFingerprint file -> do
634- di <- useNoFile_ GetModuleGraph
635- return $ lookupFingerprint file di
636-
637631dependencyInfoForFiles :: [NormalizedFilePath ] -> Action (BS. ByteString , DependencyInformation )
638632dependencyInfoForFiles fs = do
639633 (rawDepInfo, bm) <- rawDependencyInformation fs
@@ -669,7 +663,7 @@ typeCheckRuleDefinition hsc pm fp = do
669663 unlift <- askUnliftIO
670664 let dets = TypecheckHelpers
671665 { getLinkables = unliftIO unlift . uses_ GetLinkable
672- , getModuleGraph = unliftIO unlift $ useWithSeparateFingerprintRule_ GetFileModuleGraphFingerprint GetModuleGraph fp
666+ , getModuleGraph = unliftIO unlift $ useWithSeparateFingerprintRule_ GetModuleGraphTransDepsFingerprints GetModuleGraph fp
673667 }
674668 addUsageDependencies $ liftIO $
675669 typecheckModule defer hsc dets pm
@@ -768,7 +762,7 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do
768762 let inLoadOrder = map (\ HiFileResult {.. } -> HomeModInfo hirModIface hirModDetails emptyHomeModInfoLinkable) ifaces
769763 mg <- do
770764 if fullModuleGraph
771- then depModuleGraph <$> useWithSeparateFingerprintRule_ GetFileModuleGraphFingerprint GetModuleGraph file
765+ then depModuleGraph <$> useWithSeparateFingerprintRule_ GetModuleGraphTransDepsFingerprints GetModuleGraph file
772766 else do
773767 let mgs = map hsc_mod_graph depSessions
774768 -- On GHC 9.4+, the module graph contains not only ModSummary's but each `ModuleNode` in the graph
@@ -781,7 +775,7 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do
781775 nubOrdOn mkNodeKey (ModuleNode final_deps ms : concatMap mgModSummaries' mgs)
782776 liftIO $ evaluate $ liftRnf rwhnf module_graph_nodes
783777 return $ mkModuleGraph module_graph_nodes
784- de <- useWithSeparateFingerprintRule_ GetFileModuleGraphFingerprint GetModuleGraph file
778+ de <- useWithSeparateFingerprintRule_ GetModuleGraphTransDepsFingerprints GetModuleGraph file
785779 session' <- liftIO $ mergeEnvs hsc mg de ms inLoadOrder depSessions
786780
787781 -- Here we avoid a call to to `newHscEnvEqWithImportPaths`, which creates a new
@@ -811,7 +805,7 @@ getModIfaceFromDiskRule recorder = defineEarlyCutoff (cmapWithPrio LogShake reco
811805 , old_value = m_old
812806 , get_file_version = use GetModificationTime_ {missingFileDiagnostics = False }
813807 , get_linkable_hashes = \ fs -> map (snd . fromJust . hirCoreFp) <$> uses_ GetModIface fs
814- , get_module_graph = useWithSeparateFingerprintRule_ GetFileModuleGraphFingerprint GetModuleGraph f
808+ , get_module_graph = useWithSeparateFingerprintRule_ GetModuleGraphTransDepsFingerprints GetModuleGraph f
815809 , regenerate = regenerateHiFile session f ms
816810 }
817811 hsc_env' <- setFileCacheHook (hscEnv session)
@@ -1145,7 +1139,7 @@ needsCompilationRule file
11451139 | " boot" `isSuffixOf` fromNormalizedFilePath file =
11461140 pure (Just $ encodeLinkableType Nothing , Just Nothing )
11471141needsCompilationRule file = do
1148- graph <- useWithSeparateFingerprintRule GetFileModuleGraphFingerprint GetModuleGraph file
1142+ graph <- useWithSeparateFingerprintRule GetModuleGraphImmediateReverseDepsFingerprints GetModuleGraph file
11491143 res <- case graph of
11501144 -- Treat as False if some reverse dependency header fails to parse
11511145 Nothing -> pure Nothing
@@ -1236,7 +1230,6 @@ mainRule recorder RulesConfig{..} = do
12361230 getModIfaceRule recorder
12371231 getModSummaryRule templateHaskellWarning recorder
12381232 getModuleGraphRule recorder
1239- getModuleGraphSingleFileRule recorder
12401233 getFileHashRule recorder
12411234 knownFilesRule recorder
12421235 getClientSettingsRule recorder
@@ -1258,6 +1251,15 @@ mainRule recorder RulesConfig{..} = do
12581251 persistentDocMapRule
12591252 persistentImportMapRule
12601253 getLinkableRule recorder
1254+ defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \ GetModuleGraphTransDepsFingerprints file -> do
1255+ di <- useNoFile_ GetModuleGraph
1256+ return $ lookupFingerprint file di (depTransDepsFingerprints di)
1257+ defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \ GetModuleGraphTransReverseDepsFingerprints file -> do
1258+ di <- useNoFile_ GetModuleGraph
1259+ return $ lookupFingerprint file di (depTransReverseDepsFingerprints di)
1260+ defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \ GetModuleGraphImmediateReverseDepsFingerprints file -> do
1261+ di <- useNoFile_ GetModuleGraph
1262+ return $ lookupFingerprint file di (depImmediateReverseDepsFingerprints di)
12611263
12621264-- | Get HieFile for haskell file on NormalizedFilePath
12631265getHieFile :: NormalizedFilePath -> Action (Maybe HieFile )
0 commit comments