Skip to content

Commit 6d9584f

Browse files
committed
* I updated the setOptions function so it now also returns the generated hashBytes inside the monadic tuple (earlier, it was only returning the flags and the target).
* To thread this down, I added a new rawComponentHash field as a Maybe B.ByteString to the RawComponentInfo data type. This passes the hash from setOptions straight into getCacheDirsDefault. * Inside getCacheDirsDefault, I added a check: * If we have Just mFirstHash, I set the prefix to 'main'. Then, I initiate a new hash and update it with mFirstHash using H.updates, storing this mutated context as baseCtx. * If it's Nothing, baseCtx just gets a standard H.init. * Finally, for opts_hash, it takes that baseCtx and updates it with the opts string (converted via B.pack). This gives out the final 40-character hex string for the SHA1 hash. (Also updated getCacheDirs in the session loading to accept the ByteString). This keeps the path short and stops Windows from crashing
1 parent 7d02159 commit 6d9584f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Data.List.Extra as L
4040
import qualified Data.Map.Strict as Map
4141
import Data.Maybe
4242
import Data.Proxy
43+
4344
import qualified Data.Text as T
4445
import Data.Version
4546
import Development.IDE.Core.RuleTypes
@@ -682,8 +683,10 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
682683
, sessionLoadingOptions = newSessionLoadingOptions
683684
}
684685

686+
685687
writeTQueue que (runReaderT (getOptionsLoop recorder sessionShake sessionState knownTargetsVar) sessionEnv)
686688

689+
687690
-- Each one of deps will be registered as a FileSystemWatcher in the GhcSession action
688691
-- so that we can get a workspace/didChangeWatchedFiles notification when a dep changes.
689692
-- The GlobPattern of a FileSystemWatcher can be absolute or relative.
@@ -1072,8 +1075,10 @@ toFlagsMap :: TargetDetails -> [(NormalizedFilePath, (IdeResult HscEnvEq, Depend
10721075
toFlagsMap TargetDetails{..} =
10731076
[ (l, (targetEnv, targetDepends)) | l <- targetLocations]
10741077

1078+
10751079
-- | Mapping from @hie.yaml@ to all components that have been loaded
10761080
-- from this @hie.yaml@ location.
1081+
10771082
--
10781083
-- See Note [Multi Cradle Dependency Info]
10791084
type HieMap = Map.Map (Maybe FilePath) [RawComponentInfo]
@@ -1102,6 +1107,7 @@ memoIO op = do
11021107
return (Map.insert k res mp, res)
11031108
Just res -> return (mp, res)
11041109

1110+
11051111
----------------------------------------------------------------------------------------------------
11061112

11071113
data PackageSetupException

0 commit comments

Comments
 (0)