@@ -481,7 +481,14 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir = do
481
481
let hieYamlRule :: Rules ()
482
482
hieYamlRule = defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \ HieYaml hieYaml -> do
483
483
alwaysRerun
484
+ -- v :: HashMap NormalizedFilePath (IdeResult HscEnvEq, DependencyInfo)
484
485
v <- Map. findWithDefault HM. empty (Just $ fromNormalizedFilePath hieYaml) <$> (liftIO $ readVar fileToFlags)
486
+ let deps = snd <$> HM. elems v
487
+ let files = concatMap Map. keys deps
488
+ -- use time for for deps files
489
+
490
+
491
+ -- check if all dep is up to date, if not clear the cache
485
492
return $ Just v
486
493
487
494
let cradleLocRule :: Rules ()
@@ -641,7 +648,8 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir = do
641
648
liftIO $ void $ modifyVar' filesMap $ flip HM. union (HM. fromList (map ((,hieYaml) . fst ) $ concatMap toFlagsMap all_targets))
642
649
-- The VFS doesn't change on cradle edits, re-use the old one.
643
650
-- Invalidate all the existing GhcSession build nodes by restarting the Shake session
644
- keys2 <- liftIO $ invalidateShakeCache
651
+ keys2 <- liftIO invalidateShakeCache
652
+ keys1 <- liftIO $ extendKnownTargets all_targets
645
653
646
654
-- Typecheck all files in the project on startup
647
655
checkProject <- liftIO $ getCheckProject
@@ -660,7 +668,6 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir = do
660
668
-- todo this should be moving out of the session function
661
669
restart <- liftIO $ async $ do
662
670
restartShakeSession VFSUnmodified " new component" typeCheckAll $ do
663
- keys1 <- extendKnownTargets all_targets
664
671
return [keys1, keys2]
665
672
UnliftIO. wait restart
666
673
return $ second Map. keys this_options
@@ -745,17 +752,15 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir = do
745
752
-- If the dependencies are out of date then clear both caches and start
746
753
-- again.
747
754
clearCache
748
- -- fileToFlags is caching
749
755
v <- Map. findWithDefault HM. empty hieYaml <$> (liftIO$ readVar fileToFlags)
750
756
case HM. lookup file v of
751
757
Just (opts, old_di) -> do
752
758
deps_ok <- liftIO $ checkDependencyInfo old_di
753
759
if not deps_ok
754
760
then do
755
- -- If the dependencies are out of date then clear both caches and start
756
- -- again.
757
- liftIO $ clearCache
761
+ liftIO clearCache
758
762
consultCradle file
763
+ -- add the dependency info to the cache
759
764
else return (opts, Map. keys old_di)
760
765
Nothing -> consultCradle file
761
766
0 commit comments