@@ -570,7 +570,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
570
570
571
571
572
572
let session :: (Maybe FilePath , NormalizedFilePath , ComponentOptions , FilePath )
573
- -> IO ((IdeResult HscEnvEq ,DependencyInfo ), HashSet FilePath )
573
+ -> IO ((IdeResult HscEnvEq ,DependencyInfo ), HashSet FilePath , IO () )
574
574
session args@ (hieYaml, _cfp, _opts, _libDir) = do
575
575
(new_deps, old_deps) <- packageSetup args
576
576
@@ -610,21 +610,21 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
610
610
checkProject <- getCheckProject
611
611
-- The VFS doesn't change on cradle edits, re-use the old one.
612
612
-- Invalidate all the existing GhcSession build nodes by restarting the Shake session
613
- restartShakeSession VFSUnmodified " new component" [] $ do
614
- keys2 <- invalidateShakeCache
615
- keys1 <- extendKnownTargets all_targets
616
- unless (null new_deps || not checkProject) $ do
617
- cfps' <- liftIO $ filterM (IO. doesFileExist . fromNormalizedFilePath) (concatMap targetLocations all_targets)
618
- void $ shakeEnqueue extras $ mkDelayedAction " InitialLoad" Debug $ void $ do
619
- mmt <- uses GetModificationTime cfps'
620
- let cs_exist = catMaybes (zipWith (<$) cfps' mmt)
621
- modIfaces <- uses GetModIface cs_exist
622
- -- update exports map
623
- shakeExtras <- getShakeExtras
624
- let ! exportsMap' = createExportsMap $ mapMaybe (fmap hirModIface) modIfaces
625
- liftIO $ atomically $ modifyTVar' (exportsMap shakeExtras) (exportsMap' <> )
626
- return [keys1, keys2]
627
- return $ (this_options, newLoaded)
613
+ let restart = restartShakeSession VFSUnmodified " new component" [] $ do
614
+ keys2 <- invalidateShakeCache
615
+ keys1 <- extendKnownTargets all_targets
616
+ unless (null new_deps || not checkProject) $ do
617
+ cfps' <- liftIO $ filterM (IO. doesFileExist . fromNormalizedFilePath) (concatMap targetLocations all_targets)
618
+ void $ shakeEnqueue extras $ mkDelayedAction " InitialLoad" Debug $ void $ do
619
+ mmt <- uses GetModificationTime cfps'
620
+ let cs_exist = catMaybes (zipWith (<$) cfps' mmt)
621
+ modIfaces <- uses GetModIface cs_exist
622
+ -- update exports map
623
+ shakeExtras <- getShakeExtras
624
+ let ! exportsMap' = createExportsMap $ mapMaybe (fmap hirModIface) modIfaces
625
+ liftIO $ atomically $ modifyTVar' (exportsMap shakeExtras) (exportsMap' <> )
626
+ return [keys1, keys2]
627
+ return (this_options, newLoaded, restart )
628
628
629
629
let consultCradle :: Maybe FilePath -> FilePath -> IO ()
630
630
consultCradle hieYaml cfp = do
@@ -667,13 +667,14 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
667
667
[] -> error $ " GHC version could not be parsed: " <> version
668
668
((runTime, _): _)
669
669
| compileTime == runTime -> do
670
- (_results, allNewLoaded) <- session (hieYaml, ncfp, opts, libDir)
670
+ (_results, allNewLoaded, restart ) <- session (hieYaml, ncfp, opts, libDir)
671
671
let newLoaded = pendingFiles `Set.intersection` allNewLoaded
672
672
-- log new loaded files
673
673
logWith recorder Info $ LogSessionNewLoadedFiles $ Set. toList newLoaded
674
674
-- remove all new loaded file from error loading files
675
675
atomicModifyIORef' error_loading_files (\ old -> (old `Set.difference` allNewLoaded, () ))
676
676
atomicModifyIORef' cradle_files (\ xs -> (newLoaded <> xs,() ))
677
+ restart
677
678
| otherwise -> do
678
679
-- delete cfp from pending files
679
680
atomically $ do
@@ -782,7 +783,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
782
783
-- before attempting to do so.
783
784
let getOptionsWorker :: FilePath -> IO ()
784
785
getOptionsWorker file = do
785
- logWith recorder Info (LogGetOptionsLoop file)
786
+ logWith recorder Debug (LogGetOptionsLoop file)
786
787
let ncfp = toNormalizedFilePath' file
787
788
cachedHieYamlLocation <- atomically $ STM. lookup ncfp filesMap
788
789
hieYaml <- cradleLoc file
@@ -808,7 +809,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
808
809
Extra. whenM (S. lookup absFile pendingFileSet) STM. retry
809
810
-- check if in the cache
810
811
checkInCache ncfp
811
- logWith recorder Info $ LogLookupSessionCache absFile
812
+ logWith recorder Debug $ LogLookupSessionCache absFile
812
813
updateDateRes <- case res of
813
814
Just r -> do
814
815
depOk <- checkDependencyInfo (snd r)
0 commit comments