-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathlakefile.lean
More file actions
72 lines (60 loc) · 2.23 KB
/
lakefile.lean
File metadata and controls
72 lines (60 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/-
Copyright (c) 2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import Lean.Elab.Import
import Lake
open Lake DSL
open System (FilePath)
require versowebcomponents from git "https://github.com/leanprover/verso-web-components"@"main"
require illuminate from git "https://github.com/leanprover/illuminate"@"main"
require verso from git "https://github.com/leanprover/verso.git"@"main"
package "verso-manual" where
-- building the C code cost much more than the optimizations save
moreLeancArgs := #["-O0"]
-- work around clang emitting invalid linker optimization hints that lld rejects
moreLinkArgs :=
if System.Platform.isOSX then
#["-Wl,-ignore_optimization_hints"]
else #[]
leanOptions := #[
⟨`weak.verso.code.warnLineLength, .ofNat 72⟩,
⟨`weak.linter.typography.dashes, true⟩,
⟨`weak.linter.typography.quotes, true⟩,
⟨`weak.linter.typ, .ofNat 72⟩
]
-- Extended examples used in the grind chapter
@[default_target]
lean_lib IndexMap where
srcDir := "extended-examples"
@[default_target]
lean_lib IndexMapGrind where
srcDir := "extended-examples"
@[default_target]
lean_lib Manual where
/-- Ensure that the subverso-extract-mod executable is available -/
target subversoExtractMod : FilePath := do
let some pkg := ← findPackageByName? `subverso
| failure
let some exe := pkg.findLeanExe? `«subverso-extract-mod»
| failure
exe.fetch
@[default_target]
lean_exe "generate-manual" where
needs := #[`@/subversoExtractMod]
root := `Main
@[default_target]
lean_lib Tutorial where
@[default_target]
lean_exe "generate-tutorials" where
root := `TutorialMain
def lakeExe (prog : String) (args : Array String) : IO Unit := do
IO.println s!"Running {prog} with args {args}"
-- Using spawn and wait here causes the process to inherit stdio streams from Lake, so output is immediately visible
let code ← IO.Process.Child.wait <| (← IO.Process.spawn { cmd := "lake", args := #["--quiet", "exe", prog] ++ args })
if code ≠ 0 then
let code' := code.toUInt8
let code := if code' ≠ 0 then code' else 1
IO.eprintln s!"Failed to run {prog} with args {args}"
IO.Process.exit code