Skip to content

Commit

Permalink
Rename envProjectRoot to envInitialRoot and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcadman committed May 3, 2024
1 parent a779c30 commit 1a46c11
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Juvix/Compiler/Pipeline/Loader/PathResolver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ addRootDependency conf e root = do
resolvedDependency <- resolveDependency d
checkRemoteDependency resolvedDependency
let p = resolvedDependency ^. resolvedDependencyPath
withEnvProjectRoot p $ do
withEnvInitialRoot p $ do
pkg <- mkPackage (Just e) p
shouldUpdateLockfile' <- shouldUpdateLockfile pkg
when shouldUpdateLockfile' setShouldUpdateLockfile
Expand Down Expand Up @@ -406,7 +406,7 @@ runPathResolver2 st topEnv arg = do
env' =
ResolverEnv
{ _envRoot = root',
_envProjectRoot = root',
_envInitialRoot = root',
_envLockfileInfo = Nothing,
_envSingleFile
}
Expand All @@ -430,7 +430,7 @@ runPathResolver' st root x = do
env =
ResolverEnv
{ _envRoot = root,
_envProjectRoot = root,
_envInitialRoot = root,
_envLockfileInfo = Nothing,
_envSingleFile
}
Expand Down
10 changes: 6 additions & 4 deletions src/Juvix/Compiler/Pipeline/Loader/PathResolver/Data.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import Juvix.Compiler.Pipeline.Package.Base
import Juvix.Prelude

data ResolverEnv = ResolverEnv
{ _envRoot :: Path Abs Dir,
_envProjectRoot :: Path Abs Dir,
{ -- | The root path of the current project being resolved
_envRoot :: Path Abs Dir,
-- | The root path of the initial project (i.e the first project considered in the resolution)
_envInitialRoot :: Path Abs Dir,
-- | The path of the input file *if* we are using the global project
_envSingleFile :: Maybe (Path Abs File),
_envLockfileInfo :: Maybe LockfileInfo
Expand Down Expand Up @@ -62,8 +64,8 @@ checkRemoteDependency d = case d ^. resolvedDependencyDependency of
withEnvRoot :: (Members '[Reader ResolverEnv] r) => Path Abs Dir -> Sem r a -> Sem r a
withEnvRoot root' = local (set envRoot root')

withEnvProjectRoot :: (Members '[Reader ResolverEnv] r) => Path Abs Dir -> Sem r a -> Sem r a
withEnvProjectRoot projectRoot = local (set envProjectRoot projectRoot) . local (set envRoot projectRoot)
withEnvInitialRoot :: (Members '[Reader ResolverEnv] r) => Path Abs Dir -> Sem r a -> Sem r a
withEnvInitialRoot projectRoot = local (set envInitialRoot projectRoot) . local (set envRoot projectRoot)

withLockfile :: (Members '[Reader ResolverEnv] r) => LockfileInfo -> Sem r a -> Sem r a
withLockfile f = local (set envLockfileInfo (Just f))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ runDependencyResolver = runProvider_ helper
_resolvedDependencyDependency = i ^. packageDepdendencyInfoDependency
}
DependencyGit g -> do
let r = rootBuildDir (env ^. envProjectRoot)
let r = rootBuildDir (env ^. envInitialRoot)
gitCacheDir <- globalGitCache
let cloneRelDir :: Path Rel Dir
cloneRelDir = mkSafeDir (g ^. gitDependencyUrl)
Expand Down

0 comments on commit 1a46c11

Please sign in to comment.