aboutsummaryrefslogtreecommitdiff
path: root/lib/Distribution/Helper.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-03-29 03:44:48 +0100
committerDaniel Gröber <dxld@darkboxed.org>2019-03-29 03:44:48 +0100
commitb9204e27abe8e5d6150c2a35d8a525f6aa1cfdb9 (patch)
tree6141276b590b5e43c9458dafc9c6870ce6fce78f /lib/Distribution/Helper.hs
parentac6047c57d7b2c1ccbea112c0c2bdefcbc2f251d (diff)
docs
Diffstat (limited to 'lib/Distribution/Helper.hs')
-rw-r--r--lib/Distribution/Helper.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs
index 964d722..f38d6d5 100644
--- a/lib/Distribution/Helper.hs
+++ b/lib/Distribution/Helper.hs
@@ -202,7 +202,7 @@ mkQueryEnv projloc distdir = do
, qeCacheRef = cr
}
--- | Construct paths to project configuration files.
+-- | Construct paths to project configuration files given where the project is.
projConf :: ProjLoc pt -> ProjConf pt
projConf (ProjLocCabalFile cabal_file) =
ProjConfV1 cabal_file
@@ -218,6 +218,11 @@ projConf (ProjLocStackYaml stack_yaml) =
ProjConfStack
{ pcStackYaml = stack_yaml }
+-- | Get the current modification-time for each file involved in configuring a
+-- project. Optional files in 'ProjConf' are handled by not including them in
+-- the result list in 'ProjConfModTimes' if they don\'t exist. This causes the
+-- lists to be different if the files end up existing later, which is all we
+-- need for cache invalidation.
getProjConfModTime :: ProjConf pt -> IO ProjConfModTimes
getProjConfModTime ProjConfV1{pcV1CabalFile} =
fmap ProjConfModTimes $ mapM getFileModTime
@@ -263,14 +268,14 @@ compilerVersion = Query $ \qe ->
getProjInfo qe >>= \proj_info ->
let someUnit = NonEmpty.head $ piUnits proj_info in
-- ^ TODO: ASSUMPTION: Here we assume the compiler version is uniform
- -- across all units so here we just pick any one. I'm not sure this is true
- -- for Stack.
+ -- across all units so we just pick any one. I'm not sure this is true for
+ -- Stack.
case piImpl proj_info of
ProjInfoV1 -> uiCompilerId <$> getUnitInfo qe someUnit
ProjInfoV2 { piV2CompilerId } -> return piV2CompilerId
ProjInfoStack {} -> uiCompilerId <$> getUnitInfo qe someUnit
--- | All units currently active in a project\'s build plan.
+-- | All local units currently active in a project\'s build plan.
projectUnits :: Query pt (NonEmpty (Unit pt))
projectUnits = Query $ \qe -> piUnits <$> getProjInfo qe
@@ -377,7 +382,9 @@ shallowReconfigureProject QueryEnv
return ()
shallowReconfigureProject QueryEnv
{ qeProjLoc = ProjLocStackYaml _stack_yaml, .. } = do
- -- -- In case we ever need to read the cabal files before the Unit stage, this command regenerates them from package.yaml
+ -- In case we ever need to read the cabal files before the Unit stage, this
+ -- command regenerates them from package.yaml
+ --
-- _ <- liftIO $ qeCallProcess (Just projdir) (stackProgram qePrograms)
-- ["build", "--dry-run"] ""
return ()