refactor: move afterTarget* into ActiveBuildTarget

This commit is contained in:
tydeu 2021-08-01 15:40:11 -04:00
parent 2d78f4db36
commit b8e85f40cd
2 changed files with 8 additions and 8 deletions

View file

@ -12,7 +12,7 @@ namespace Lake
def buildLeanO (oFile : FilePath)
(cTarget : ActiveBuildTarget t FilePath) (leancArgs : Array String := #[]) : IO BuildTask :=
afterTarget cTarget <| compileLeanO oFile cTarget.artifact leancArgs
cTarget >> compileLeanO oFile cTarget.artifact leancArgs
def fetchLeanOFileTarget (oFile : FilePath)
(cTarget : ActiveFileTarget) (leancArgs : Array String := #[]) : IO ActiveFileTarget :=

View file

@ -88,21 +88,21 @@ def nil [Inhabited t] : ActiveBuildTarget t PUnit :=
def materialize (self : ActiveBuildTarget t α) : IO PUnit :=
self.task.await
end ActiveBuildTarget
-- ### Combinators
-- ## Combinators
def afterTarget (target : ActiveBuildTarget t a) (act : IO PUnit) : IO BuildTask :=
def after (target : ActiveBuildTarget t a) (act : IO PUnit) : IO BuildTask :=
afterTask target.task act
def afterTargetList (targets : List (ActiveBuildTarget t a)) (act : IO PUnit) : IO BuildTask :=
def afterList (targets : List (ActiveBuildTarget t a)) (act : IO PUnit) : IO BuildTask :=
afterTaskList (targets.map (·.task)) act
instance : HAndThen (ActiveBuildTarget t a) (IO PUnit) (IO BuildTask) :=
afterTarget
ActiveBuildTarget.after
instance : HAndThen (List (ActiveBuildTarget t a)) (IO PUnit) (IO BuildTask) :=
⟨afterTargetList⟩
⟨ActiveBuildTarget.afterList⟩
end ActiveBuildTarget
--------------------------------------------------------------------------------
-- # File Targets