b023c4d3b58f31640a61c3e242a39b8058c08a2f
[hadrian.git] / src / Context / Paths.hs
1 module Context.Paths where
2
3 import Base
4 import Context.Type
5 import Hadrian.Expression
6
7 -- | The directory to the current stage
8 stageDir :: Context -> FilePath
9 stageDir Context {..} = stageString stage
10
11 -- | The path to the current stage
12 stagePath :: Context -> Action FilePath
13 stagePath context = buildRoot <&> (-/- stageDir context)
14
15 getStagePath :: Expr Context b FilePath
16 getStagePath = expr . stagePath =<< getContext
17
18 -- | The directory in 'buildRoot' containing build artifacts of a given 'Context'.
19 contextDir :: Context -> FilePath
20 contextDir Context {..} = stageString stage -/- pkgPath package
21
22 -- | Path to the context directory, containing the "build folder"
23 contextPath :: Context -> Action FilePath
24 contextPath context = buildRoot <&> (-/- contextDir context)
25
26 getContextPath :: Expr Context b FilePath
27 getContextPath = expr . contextPath =<< getContext
28
29 -- | The directory in 'buildRoot' containing the object artifacts.
30 buildDir :: Context -> FilePath
31 buildDir context = contextDir context -/- "build"
32
33 -- | Path to the directory containing build artifacts of a given 'Context'.
34 buildPath :: Context -> Action FilePath
35 buildPath context = buildRoot <&> (-/- buildDir context)
36
37 -- | Get the build path of the current 'Context'.
38 getBuildPath :: Expr Context b FilePath
39 getBuildPath = expr . buildPath =<< getContext