refactor: rename LakeTrace to BuildTrace

This commit is contained in:
tydeu 2021-09-04 17:49:08 -04:00
parent 80416677d8
commit dba37698c8
3 changed files with 17 additions and 17 deletions

View file

@ -70,8 +70,8 @@ def skipIf [Pure m] [Pure n] (cond : Bool) (build : m (n PUnit)) : m (n PUnit) :
if cond then pure (pure ()) else build
def checkModuleTrace [GetMTime i] (info : i)
(leanFile hashFile : FilePath) (contents : String) (depTrace : LakeTrace)
: IO (Bool × LakeTrace) := do
(leanFile hashFile : FilePath) (contents : String) (depTrace : BuildTrace)
: IO (Bool × BuildTrace) := do
let leanMTime ← getMTime leanFile
let leanHash := Hash.compute contents
let maxMTime := max leanMTime depTrace.mtime

View file

@ -14,12 +14,12 @@ namespace Lake
--------------------------------------------------------------------------------
/-- A Lake build target. -/
abbrev BuildTarget i := Target i BuildM BuildTask LakeTrace
abbrev BuildTarget i := Target i BuildM BuildTask BuildTrace
-- ## Active
/-- An active Lake build target. -/
abbrev ActiveBuildTarget i := ActiveTarget i BuildTask LakeTrace
abbrev ActiveBuildTarget i := ActiveTarget i BuildTask BuildTrace
--------------------------------------------------------------------------------
-- # File Targets
@ -44,7 +44,7 @@ abbrev OpaqueTarget := BuildTarget PUnit
namespace OpaqueTarget
abbrev nil : OpaqueTarget :=
Target.pure () LakeTrace.nil
Target.pure () BuildTrace.nil
def mixAsync (t1 t2 : OpaqueTarget) : OpaqueTarget :=
Target.opaque do
@ -66,7 +66,7 @@ abbrev ActiveOpaqueTarget := ActiveBuildTarget PUnit
namespace ActiveOpaqueTarget
abbrev nil : ActiveOpaqueTarget :=
ActiveTarget.pure () LakeTrace.nil
ActiveTarget.pure () BuildTrace.nil
def mixAsync (t1 t2 : ActiveOpaqueTarget) : BuildM ActiveOpaqueTarget := do
ActiveTarget.opaque <| ←

View file

@ -150,31 +150,31 @@ def checkIfNewer [GetMTime a] (artifact : a) (depMTime : MTime) : IO Bool := do
--------------------------------------------------------------------------------
/-- Trace used for common Lake targets. Combines `Hash` and `MTime`. -/
structure LakeTrace where
structure BuildTrace where
hash : Hash
mtime : MTime
namespace LakeTrace
namespace BuildTrace
def fromHash (hash : Hash) : LakeTrace :=
def fromHash (hash : Hash) : BuildTrace :=
mk hash 0
def fromMTime (mtime : MTime) : LakeTrace :=
def fromMTime (mtime : MTime) : BuildTrace :=
mk Hash.nil mtime
def nil : LakeTrace :=
def nil : BuildTrace :=
mk Hash.nil 0
instance : NilTrace LakeTrace := ⟨nil⟩
instance : NilTrace BuildTrace := ⟨nil⟩
def compute [ComputeHash a] [GetMTime a] (artifact : a) : IO LakeTrace := do
def compute [ComputeHash a] [GetMTime a] (artifact : a) : IO BuildTrace := do
mk (← computeHash artifact) (← getMTime artifact)
instance [ComputeHash a] [GetMTime a] : ComputeTrace a IO LakeTrace := ⟨compute⟩
instance [ComputeHash a] [GetMTime a] : ComputeTrace a IO BuildTrace := ⟨compute⟩
def mix (t1 t2 : LakeTrace) : LakeTrace :=
def mix (t1 t2 : BuildTrace) : BuildTrace :=
mk (Hash.mix t1.hash t2.hash) (max t1.mtime t2.mtime)
instance : MixTrace LakeTrace := ⟨mix⟩
instance : MixTrace BuildTrace := ⟨mix⟩
end LakeTrace
end BuildTrace