@@ -169,6 +169,7 @@ import GHC.Unit.Env
169
169
import GHC.Unit.Home.ModInfo
170
170
#endif
171
171
import GHC (mgModSummaries )
172
+ import GHC.Fingerprint
172
173
173
174
data Log
174
175
= LogShake Shake. Log
@@ -523,7 +524,7 @@ rawDependencyInformation fs = do
523
524
524
525
reportImportCyclesRule :: Recorder (WithPriority Log ) -> Rules ()
525
526
reportImportCyclesRule 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
527
528
DependencyInformation {.. } <- useNoFile_ GetModuleGraph
528
529
let fileId = pathToId depPathIdMap file
529
530
case IntMap. lookup (getFilePathId fileId) depErrorNodes of
@@ -671,15 +672,16 @@ knownFilesRule recorder = defineEarlyCutOffNoFile (cmapWithPrio LogShake recorde
671
672
pure (LBS. toStrict $ B. encode $ hash fs, unhashed fs)
672
673
673
674
getModuleGraphRule :: Recorder (WithPriority Log ) -> Rules ()
674
- getModuleGraphRule recorder = defineNoFile (cmapWithPrio LogShake recorder) $ \ GetModuleGraph -> do
675
+ getModuleGraphRule recorder = defineEarlyCutOffNoFile (cmapWithPrio LogShake recorder) $ \ GetModuleGraph -> do
675
676
fs <- toKnownFiles <$> useNoFile_ GetKnownTargets
676
677
dependencyInfoForFiles (HashSet. toList fs)
677
678
678
- dependencyInfoForFiles :: [NormalizedFilePath ] -> Action DependencyInformation
679
+ dependencyInfoForFiles :: [NormalizedFilePath ] -> Action ( BS. ByteString , DependencyInformation )
679
680
dependencyInfoForFiles fs = do
680
681
(rawDepInfo, bm) <- rawDependencyInformation fs
681
682
let (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
683
685
#if MIN_VERSION_ghc(9,3,0)
684
686
let deps = map (\ i -> IM. lookup (getFilePathId i) (rawImports rawDepInfo)) _all_ids
685
687
nodeKeys = IM. fromList $ catMaybes $ zipWith (\ fi mms -> (getFilePathId fi,) . NodeKey_Module . msKey <$> mms) _all_ids mss
@@ -700,7 +702,7 @@ dependencyInfoForFiles fs = do
700
702
#endif
701
703
(catMaybes mss)
702
704
#endif
703
- pure $ processDependencyInformation rawDepInfo bm mg
705
+ pure (fingerprintToBS $ Util. fingerprintFingerprints $ map ( maybe fingerprint0 msrFingerprint) msrs, processDependencyInformation rawDepInfo bm mg)
704
706
705
707
-- This is factored out so it can be directly called from the GetModIface
706
708
-- rule. Directly calling this rule means that on the initial load we can
@@ -793,7 +795,7 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do
793
795
case mbdeps of
794
796
Nothing -> return Nothing
795
797
Just deps -> do
796
- when fullModuleGraph $ void $ uses_ ReportImportCycles deps
798
+ when fullModuleGraph $ void $ use_ ReportImportCycles file
797
799
ms <- msrModSummary <$> if fullModSummary
798
800
then use_ GetModSummary file
799
801
else use_ GetModSummaryWithoutTimestamps file
0 commit comments