feat: add inputFileTarget util

This commit is contained in:
tydeu 2021-10-08 15:26:07 -04:00
parent 85efdb159a
commit 427cb0fc7c
3 changed files with 4 additions and 3 deletions

View file

@ -40,8 +40,6 @@ def computeAsync (path : FilePath) : FileTarget :=
Target.mk path do async <| try liftM <| computeTrace path catch e =>
BuildM.logError (toString e); throw e
instance : Coe FilePath FileTarget := ⟨computeAsync⟩
end FileTarget
-- ## Active

View file

@ -11,6 +11,9 @@ namespace Lake
-- # General Utilities
def inputFileTarget := FileTarget.computeAsync
instance : Coe FilePath FileTarget := ⟨inputFileTarget⟩
def buildFileUnlessUpToDate (file : FilePath)
(trace : BuildTrace) (build : BuildM PUnit) : BuildM BuildTrace := do
let traceFile := FilePath.mk <| file.toString ++ ".trace"

View file

@ -7,7 +7,7 @@ def buildDir := defaultBuildDir
def ffiOTarget (pkgDir : FilePath) : FileTarget :=
let oFile := pkgDir / buildDir / cDir / "ffi.o"
let srcTarget : FileTarget := coe <| pkgDir / ffiSrc
let srcTarget := inputFileTarget <| pkgDir / ffiSrc
fileTargetWithDep oFile srcTarget fun srcFile => do
compileO oFile srcFile #["-I", (← getLeanIncludeDir).toString]