feat: experimental module facet for producing docs

main
tydeu 2022-07-23 20:07:30 -04:00
parent 3924034385
commit 5e78890ec0
1 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import Lake
open Lake DSL
import Lake.CLI.Main
open System Lake DSL
package «doc-gen4»
@ -25,3 +26,22 @@ require lake from git
require leanInk from git
"https://github.com/hargonix/LeanInk" @ "doc-gen"
module_facet docs : FilePath := fun mod => do
let some docGen4 ← findLeanExe? `«doc-gen4»
| error "no doc-gen4 executable configuration found in workspace"
let exeTarget ← docGen4.exe.recBuild
let modTarget ← mod.leanBin.recBuild
let buildDir := (← getWorkspace).root.buildDir
let docFile := mod.filePath (buildDir / "doc") "html"
let task ← show SchedulerM _ from do
exeTarget.bindAsync fun exeFile exeTrace => do
modTarget.bindSync fun _ modTrace => do
let depTrace := exeTrace.mix modTrace
buildFileUnlessUpToDate docFile depTrace do
proc {
cmd := exeFile.toString
args := #["single", mod.name.toString]
env := #[("LEAN_PATH", (← getAugmentedLeanPath).toString)]
}
return ActiveTarget.mk docFile task