@@ -169,6 +169,7 @@ import GHC.Unit.Env
169169import GHC.Unit.Home.ModInfo
170170#endif
171171import GHC (mgModSummaries )
172+ import GHC.Fingerprint
172173
173174data Log
174175= LogShake Shake. Log
@@ -523,7 +524,7 @@ rawDependencyInformation fs = do
523524
524525reportImportCyclesRule :: Recorder (WithPriority Log ) -> Rules ()
525526reportImportCyclesRule recorder =
526- define (cmapWithPrio LogShake recorder) $ \ ReportImportCycles file -> fmap (\ errs -> if null errs then ([] , Just () ) else (errs, Nothing )) $ do
527+ defineEarlyCutoff (cmapWithPrio LogShake recorder) $ Rule $ \ ReportImportCycles file -> fmap (\ errs -> if null errs then (Just " 1 " ,( [] , Just () )) else (Nothing , ( errs, Nothing ) )) $ do
527528DependencyInformation {.. } <- useNoFile_ GetModuleGraph
528529let fileId = pathToId depPathIdMap file
529530case IntMap. lookup (getFilePathId fileId) depErrorNodes of
@@ -671,15 +672,16 @@ knownFilesRule recorder = defineEarlyCutOffNoFile (cmapWithPrio LogShake recorde
671672pure (LBS. toStrict $ B. encode $ hash fs, unhashed fs)
672673
673674getModuleGraphRule :: Recorder (WithPriority Log ) -> Rules ()
674- getModuleGraphRule recorder = defineNoFile (cmapWithPrio LogShake recorder) $ \ GetModuleGraph -> do
675+ getModuleGraphRule recorder = defineEarlyCutOffNoFile (cmapWithPrio LogShake recorder) $ \ GetModuleGraph -> do
675676 fs <- toKnownFiles <$> useNoFile_ GetKnownTargets
676677 dependencyInfoForFiles (HashSet. toList fs)
677678
678- dependencyInfoForFiles :: [NormalizedFilePath ] -> Action DependencyInformation
679+ dependencyInfoForFiles :: [NormalizedFilePath ] -> Action ( BS. ByteString , DependencyInformation )
679680dependencyInfoForFiles fs = do
680681 (rawDepInfo, bm) <- rawDependencyInformation fs
681682let (all_fs, _all_ids) = unzip $ HM. toList $ pathToIdMap $ rawPathIdMap rawDepInfo
682- mss <- map (fmap msrModSummary) <$> uses GetModSummaryWithoutTimestamps all_fs
683+ msrs <- uses GetModSummaryWithoutTimestamps all_fs
684+ let mss = map (fmap msrModSummary) msrs
683685#if MIN_VERSION_ghc(9,3,0)
684686let deps = map (\ i -> IM. lookup (getFilePathId i) (rawImports rawDepInfo)) _all_ids
685687 nodeKeys = IM. fromList $ catMaybes $ zipWith (\ fi mms -> (getFilePathId fi,) . NodeKey_Module . msKey <$> mms) _all_ids mss
@@ -700,7 +702,7 @@ dependencyInfoForFiles fs = do
700702#endif
701703 (catMaybes mss)
702704#endif
703- pure $ processDependencyInformation rawDepInfo bm mg
705+ pure (fingerprintToBS $ Util. fingerprintFingerprints $ map ( maybe fingerprint0 msrFingerprint) msrs, processDependencyInformation rawDepInfo bm mg)
704706
705707-- This is factored out so it can be directly called from the GetModIface
706708-- rule. Directly calling this rule means that on the initial load we can
@@ -793,7 +795,7 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do
793795case mbdeps of
794796Nothing -> return Nothing
795797Just deps -> do
796- when fullModuleGraph $ void $ uses_ ReportImportCycles deps
798+ when fullModuleGraph $ void $ use_ ReportImportCycles file
797799 ms <- msrModSummary <$> if fullModSummary
798800then use_ GetModSummary file
799801else use_ GetModSummaryWithoutTimestamps file
0 commit comments