@@ -924,19 +924,20 @@ defineEarlyCutoff
924
924
=> RuleBody k v
925
925
-> Rules ()
926
926
defineEarlyCutoff (Rule op) = addBuiltinRule noLint noIdentity $ \ (Q (key, file)) (old :: Maybe BS. ByteString ) mode -> otTracedAction key file isSuccess $ do
927
- defineEarlyCutoff' key file old mode $ op key file
927
+ defineEarlyCutoff' True key file old mode $ op key file
928
928
defineEarlyCutoff (RuleNoDiagnostics op) = addBuiltinRule noLint noIdentity $ \ (Q (key, file)) (old :: Maybe BS. ByteString ) mode -> otTracedAction key file isSuccess $ do
929
- defineEarlyCutoff' key file old mode $ second (mempty ,) <$> op key file
929
+ defineEarlyCutoff' False key file old mode $ second (mempty ,) <$> op key file
930
930
931
931
defineEarlyCutoff'
932
932
:: IdeRule k v
933
- => k
933
+ => Bool -- ^ update diagnostics
934
+ -> k
934
935
-> NormalizedFilePath
935
936
-> Maybe BS. ByteString
936
937
-> RunMode
937
938
-> Action (Maybe BS. ByteString , IdeResult v )
938
939
-> Action (RunResult (A (RuleResult k )))
939
- defineEarlyCutoff' key file old mode action = do
940
+ defineEarlyCutoff' doDiagnostics key file old mode action = do
940
941
extras@ ShakeExtras {state, inProgress} <- getShakeExtras
941
942
-- don't do progress for GetFileExists, as there are lots of non-nodes for just that one key
942
943
(if show key == " GetFileExists" then id else withProgressVar inProgress file) $ do
@@ -947,7 +948,8 @@ defineEarlyCutoff' key file old mode action = do
947
948
-- No changes in the dependencies and we have
948
949
-- an existing result.
949
950
Just (v, diags) -> do
950
- updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) $ Vector. toList diags
951
+ when doDiagnostics $
952
+ updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) $ Vector. toList diags
951
953
return $ Just $ RunResult ChangedNothing old $ A v
952
954
_ -> return Nothing
953
955
_ -> return Nothing
@@ -972,7 +974,8 @@ defineEarlyCutoff' key file old mode action = do
972
974
(toShakeValue ShakeResult bs, Failed b)
973
975
Just v -> pure (maybe ShakeNoCutoff ShakeResult bs, Succeeded (vfsVersion =<< modTime) v)
974
976
liftIO $ setValues state key file res (Vector. fromList diags)
975
- updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) diags
977
+ when doDiagnostics $
978
+ updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) diags
976
979
let eq = case (bs, fmap decodeShakeValue old) of
977
980
(ShakeResult a, Just (ShakeResult b)) -> a == b
978
981
(ShakeStale a, Just (ShakeStale b)) -> a == b
0 commit comments