@@ -625,23 +625,25 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir = do
625
625
-- Invalidate all the existing GhcSession build nodes by restarting the Shake session
626
626
keys2 <- liftIO $ invalidateShakeCache
627
627
628
+ -- Typecheck all files in the project on startup
629
+ checkProject <- liftIO $ getCheckProject
630
+ cfps' <- liftIO $ filterM (IO. doesFileExist . fromNormalizedFilePath) (concatMap targetLocations all_targets)
631
+ let typeCheckAll = if null new_deps || not checkProject
632
+ then []
633
+ else return $
634
+ mkDelayedAction " InitialLoad" Debug $ void $ do
635
+ mmt <- uses GetModificationTime cfps'
636
+ let cs_exist = catMaybes (zipWith (<$) cfps' mmt)
637
+ modIfaces <- uses GetModIface cs_exist
638
+ -- update exports map
639
+ shakeExtras <- getShakeExtras
640
+ let ! exportsMap' = createExportsMap $ mapMaybe (fmap hirModIface) modIfaces
641
+ liftIO $ atomically $ modifyTVar' (exportsMap shakeExtras) (exportsMap' <> )
628
642
-- todo this should be moving out of the session function
629
643
restart <- liftIO $ async $ do
630
- restartShakeSession VFSUnmodified " new component" [] $ do
644
+ restartShakeSession VFSUnmodified " new component" typeCheckAll $ do
631
645
keys1 <- extendKnownTargets all_targets
632
646
return [keys1, keys2]
633
- -- Typecheck all files in the project on startup
634
- checkProject <- liftIO $ getCheckProject
635
- liftIO $ unless (null new_deps || not checkProject) $ do
636
- cfps' <- liftIO $ filterM (IO. doesFileExist . fromNormalizedFilePath) (concatMap targetLocations all_targets)
637
- void $ shakeEnqueue extras $ mkDelayedAction " InitialLoad" Debug $ void $ do
638
- mmt <- uses GetModificationTime cfps'
639
- let cs_exist = catMaybes (zipWith (<$) cfps' mmt)
640
- modIfaces <- uses GetModIface cs_exist
641
- -- update exports map
642
- shakeExtras <- getShakeExtras
643
- let ! exportsMap' = createExportsMap $ mapMaybe (fmap hirModIface) modIfaces
644
- liftIO $ atomically $ modifyTVar' (exportsMap shakeExtras) (exportsMap' <> )
645
647
UnliftIO. wait restart
646
648
return $ second Map. keys this_options
647
649
0 commit comments