-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlakefile.lean
More file actions
107 lines (96 loc) · 3.66 KB
/
Copy pathlakefile.lean
File metadata and controls
107 lines (96 loc) · 3.66 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
-- SPDX-License-Identifier: MPL-2.0
-- SPDX-FileCopyrightText: 2025 hyperpolymath
--
-- lakefile.lean - Lake build configuration for GQLdt
import Lake
open Lake DSL
package gqldt where
leanOptions := #[
⟨`pp.unicode.fun, true⟩, -- Use unicode λ in pretty printing
⟨`autoImplicit, false⟩ -- Require explicit type annotations
]
-- Mathlib4 for tactics (omega, simp, etc.) and proof automation
require mathlib from git
"https://github.com/leanprover-community/mathlib4" @ "v4.15.0"
-- Main library
@[default_target]
lean_lib GqlDt where
srcDir := "src"
roots := #[`GqlDt]
-- Shared test support (failure counter + exit-code summary).
-- Declared as a library so the individual test executables can `import TestHarness`;
-- a bare file under a target's srcDir is not otherwise resolvable as a module.
lean_lib TestSupport where
srcDir := "test"
roots := #[`TestHarness]
-- FFI Test executable (requires Zig library to be built first)
-- Build Zig lib: cd bridge && zig build
lean_exe ffi_test where
srcDir := "test"
root := `FFITest
-- Link against the Zig FFI bridge library
moreLinkArgs := #[
"-Lbridge/zig-out/lib",
"-llith_bridge"
]
-- Parser test executable.
-- The three pure-Lean suites are @[default_target] so a plain `lake build` compiles them.
-- Without that, `lake build` built only the GqlDt library, the test executables were never
-- compiled by CI or locally, and two of them silently rotted until they no longer compiled
-- at all. "Declared but built by nothing" is the failure mode this whole change exists to
-- close, so the suites must not reintroduce it.
@[default_target]
lean_exe parser_test where
srcDir := "test"
root := `ParserTest
-- Lexer test executable
@[default_target]
lean_exe lexer_test where
srcDir := "test"
root := `LexerTest
-- Type-safety test executable.
-- test/TypeSafetyTests.lean existed but was declared by no target, so it was never
-- built and never run — it could not even fail to compile.
@[default_target]
lean_exe type_safety_test where
srcDir := "test"
root := `TypeSafetyTests
-- Test driver: `lake test`.
--
-- Without this, `lake test` reported "no test driver configured" and exited non-zero,
-- so CI had to tolerate that failure — which meant CI also tolerated genuine test
-- failures. The suites below now return a real exit code (see test/TestHarness.lean).
--
-- ffi_test is deliberately excluded: it links against bridge/zig-out/lib/liblith_bridge.a,
-- which requires `cd bridge && zig build` first. It is run separately by the zig-ffi CI
-- job, where that artifact is guaranteed to exist. Including it here would make `lake test`
-- fail on a clean checkout for a reason unrelated to Lean.
@[test_driver]
script test do
let suites := #["lexer_test", "parser_test", "type_safety_test"]
let mut failed : Array String := #[]
for suite in suites do
let bin := System.mkFilePath [".lake", "build", "bin", suite]
if !(← System.FilePath.pathExists bin) then
IO.eprintln s!"✗ {suite}: binary not found at {bin} — run `lake build` first"
failed := failed.push suite
continue
IO.println s!"\n▶ {suite}"
let child ← IO.Process.spawn { cmd := bin.toString }
if (← child.wait) != 0 then
failed := failed.push suite
if failed.isEmpty then
IO.println s!"\n✅ all {suites.size} Lean suite(s) passed"
return 0
else
IO.eprintln s!"\n❌ FAILED: {String.intercalate ", " failed.toList}"
return 1
-- GQLdt CLI/REPL (with FFI persistence backend)
lean_exe gqldt where
srcDir := "src"
root := `Main
-- Link against the Zig FFI bridge library for persistence
moreLinkArgs := #[
"-Lbridge/zig-out/lib",
"-llith_bridge"
]