2021-11-27 15:19:45 +00:00
|
|
|
import Lake
|
2022-07-24 00:07:30 +00:00
|
|
|
import Lake.CLI.Main
|
|
|
|
open System Lake DSL
|
2021-11-27 15:19:45 +00:00
|
|
|
|
2022-06-19 14:41:59 +00:00
|
|
|
package «doc-gen4»
|
|
|
|
|
|
|
|
lean_lib DocGen4
|
|
|
|
|
|
|
|
@[defaultTarget]
|
|
|
|
lean_exe «doc-gen4» {
|
|
|
|
root := `Main
|
2021-11-27 15:19:45 +00:00
|
|
|
supportInterpreter := true
|
|
|
|
}
|
2022-06-19 14:41:59 +00:00
|
|
|
|
|
|
|
require CMark from git
|
2022-07-20 14:18:57 +00:00
|
|
|
"https://github.com/xubaiw/CMark.lean" @ "main"
|
2022-06-19 14:41:59 +00:00
|
|
|
|
|
|
|
require Unicode from git
|
2022-07-20 14:18:57 +00:00
|
|
|
"https://github.com/xubaiw/Unicode.lean" @ "main"
|
2022-06-19 14:41:59 +00:00
|
|
|
|
|
|
|
require Cli from git
|
2022-07-20 14:18:57 +00:00
|
|
|
"https://github.com/mhuisi/lean4-cli" @ "nightly"
|
2022-06-19 14:41:59 +00:00
|
|
|
|
|
|
|
require lake from git
|
2022-07-20 14:18:57 +00:00
|
|
|
"https://github.com/leanprover/lake" @ "master"
|
2022-06-19 14:41:59 +00:00
|
|
|
|
|
|
|
require leanInk from git
|
2022-07-26 13:17:56 +00:00
|
|
|
"https://github.com/hargonix/LeanInk" @ "doc-gen-json"
|
2022-07-24 00:07:30 +00:00
|
|
|
|
|
|
|
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
|