feat: experimental module facet for producing docs
parent
3924034385
commit
5e78890ec0
|
@ -1,5 +1,6 @@
|
||||||
import Lake
|
import Lake
|
||||||
open Lake DSL
|
import Lake.CLI.Main
|
||||||
|
open System Lake DSL
|
||||||
|
|
||||||
package «doc-gen4»
|
package «doc-gen4»
|
||||||
|
|
||||||
|
@ -25,3 +26,22 @@ require lake from git
|
||||||
|
|
||||||
require leanInk from git
|
require leanInk from git
|
||||||
"https://github.com/hargonix/LeanInk" @ "doc-gen"
|
"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
|
||||||
|
|
Loading…
Reference in New Issue