From d19e59312f3a6648bd53d489c60ec11b73289f40 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Fri, 16 Aug 2019 03:58:28 +0200 Subject: Make caching more fine grained Previously we only had a cache for the project info and each unit info. However adding support for passing overridden compiler paths to build tools introduces a nasty data dependency: to fully configure 'Program's we (used to) need ProjInfo which needs an already configured 'Programs' in readProjInfo (ugh). After at least four failed attempts at untangling this I arrived at this solution. Simply splitting up the caches into some smaller parts does the trick and as a side product forced me to add an abstraction for the caching logic so as to not reapeat myself even more. Relatedly runQuery is not just a field accessor anymore but actualy does some IO of itself to manage the cache and make already configured 'Program's available to the rest of the library. --- tests/GhcSession.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs index 02e5c76..9fc7899 100644 --- a/tests/GhcSession.hs +++ b/tests/GhcSession.hs @@ -323,7 +323,7 @@ test modProgs (psdImpl -> ProjSetupImpl{..}) topdir tmpdir projdir cabal_file -- TODO: Cludge until we can just build the unit dependencies -- TODO: Move back under runQuery when we fixed backpack - buildProject qe + runQuery buildProject qe cs <- concat <$> runQuery (allUnits (Map.elems . uiComponents)) qe -- cgit v1.2.3