-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbb.edn
More file actions
204 lines (174 loc) · 8.76 KB
/
Copy pathbb.edn
File metadata and controls
204 lines (174 loc) · 8.76 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
;; MAGIC dev workflows: the task graph and docs. Implementation lives in bb/magic/.
;; Run `bb tasks` for the public list.
{:min-bb-version "1.3.0"
:paths ["bb"]
:tasks
{:requires ([magic.nos :as nos])
-check-nostrand
{:doc "Abort if Nostrand has not been built yet."
:task (nos/check-built!)}
;; ============================================================
;; Build
;; ============================================================
build
{:doc "Full build: clean → runtimes → nostrand → magic-compiler bootstrap → magic-unity.
Slow every time.
Stamps committed-DLL mtimes before compiling, which a raw `dotnet build` skips.
See docs/development.md."
:requires ([magic.drift :as drift]
[magic.unity :as unity])
:task (do (drift/touch-dlls!)
(shell "dotnet build")
(unity/write-metas!))}
build-runtime
{:doc "Rebuild C# runtimes (clojure-runtime + magic-runtime) and nostrand.
No magic-compiler bootstrap.
Fast."
:task (shell "dotnet build" "nostrand/NostrandMain.csproj" "-c" "Release")}
bootstrap
{:doc "One bootstrap pass: compile magic-compiler with the compiler in references/, deploy over it (rebuilds nostrand) and into magic-unity `magic-unity/Runtime/magic`, re-record dll-sources.edn.
Slow.
Extra args go to nos build/bootstrap, e.g. `bb bootstrap :spells '[magic.spells.sparse-case/sparse-case]'`.
One pass is not the fixpoint; `bb dev-compiler` runs the usual two.
See docs/bootstrap.md."
:requires ([magic.unity :as unity])
:depends [-check-nostrand]
:task (do (nos/bootstrap! *command-line-args*)
(unity/write-metas!))}
refresh-stdlib
{:doc "Recompile every committed stdlib clojure.*.clj.dll from source, redeploy to nostrand/references/, the built host, and `magic-unity/Runtime/magic`, then re-record dll-sources.edn.
Use after editing any magic-compiler/src/stdlib/**/*.clj.
Owns every stdlib namespace outside the clojure.core family; every other committed DLL belongs to `bb bootstrap`.
See docs/bootstrap.md."
:requires ([magic.drift :as drift]
[magic.unity :as unity])
:depends [-check-nostrand]
:task (do (drift/touch-dlls!)
(nos/nos! "refresh/stdlib")
(unity/write-metas!)
(drift/record!))}
;; ============================================================
;; Generated outputs
;; ============================================================
regen-callsites
{:doc "Regenerate magic-runtime .g.cs files from .mustache templates."
:task (shell {:dir "magic-runtime/Magic.Runtime.Callsites"} "dotnet run")}
sync-upm-version
{:doc "Sync magic-unity/package.json version with version.edn (UPM manifests are not covered by Directory.Build.props)."
:requires ([magic.unity :as unity])
:task (unity/sync-upm-version!)}
sync-clojure-clr
{:doc "Add the latest release of ClojureCLR into magic-unity."
:requires ([magic.clojure-clr :as clojure-clr]
[magic.unity :as unity])
:task (do (clojure-clr/sync! (first *command-line-args*))
(unity/write-metas!))}
write-metas
{:doc "Create a Unity .meta for every magic-unity DLL that lacks one, then fail unless every one of them carries its runtime-selection constraint block.
Existing metas are never rewritten, so a wrong block is reported rather than silently corrected."
:requires ([magic.unity :as unity])
:task (do (unity/write-metas!)
(unity/check-constraints!))}
check-drift
{:doc "Regenerate everything generated (callsite .g.cs, stdlib .clj.dll, dll-sources.edn, UPM version), verify the runtime-selection constraints, and fail if any checked path differs from HEAD.
Committed DLLs are byte-diffed.
Run after a fresh `bb build` so the bootstrap set is covered too, as CI does.
See docs/deterministic-compilation.md."
:requires ([magic.drift :as drift]
[magic.unity :as unity])
:depends [regen-callsites refresh-stdlib sync-upm-version]
:task (do (unity/check-constraints!) ; run after refresh-stdlib has written the metas
(drift/check-copies!)
(drift/check!))}
;; ============================================================
;; Test + dev loops
;; ============================================================
test
{:doc "Run the magic-compiler test suite.
`bb test magic.test.fn magic.test.reify` runs specific namespaces."
:depends [-check-nostrand]
:task (if (seq *command-line-args*)
(apply nos/nos! "test/run" *command-line-args*)
(nos/nos! "test/all"))}
dev-callsites
{:doc "After editing magic-runtime/Magic.Runtime.Callsites/*.mustache: regen the .g.cs, then rebuild the runtimes.
A C# edit with no template change is just `bb build-runtime`."
:depends [regen-callsites build-runtime]}
dev-compiler
{:doc "After editing magic-compiler/src/magic/**/*.clj or mage/src/: two bootstrap passes, since only pass 2 is the fixpoint.
Slow.
Extra args go to both passes."
:requires ([magic.unity :as unity])
:depends [-check-nostrand]
:task (do (nos/bootstrap! *command-line-args*)
(nos/bootstrap! *command-line-args*)
(unity/write-metas!))}
;; ============================================================
;; Inspect / debug
;; ============================================================
pipeline
{:doc "Walk a Clojure form through reader -> AST -> symbolic IL.
Prints form, macroexpand, AST skeleton, type summary, and flattened opcode listing.
Dumps EDN to <out>/ (default magic-compiler/target).
Options: :out <dir>, :sections '#{...}' subset of #{:form :macroexpand :ast :types :il :ast-edn :il-edn :tree-edn}."
:requires ([magic.log :as log])
:depends [-check-nostrand]
:task (if (empty? *command-line-args*)
(log/fail! "missing form"
"usage: bb pipeline '<form>' [:key value]..."
"examples:"
" bb pipeline '(let [x 1] (+ x 1))'"
" bb pipeline '(let [x 1] x)' :out /tmp/x"
" bb pipeline '(let [x 1] x)' :sections '#{:ast :il}'")
(apply nos/nos! "pipeline/show" *command-line-args*))}
repl
{:doc "Start the Nostrand CLI REPL in magic-compiler/."
:override-builtin true
:depends [-check-nostrand]
:task (nos/nos! "repl")}
prepl-server
{:doc "Start a socket prepl server (io-prepl) on a warm MAGIC runtime, like an nREPL for dev.
Blocks.
Default port 5555; override: bb prepl-server 5560.
Send forms from another shell with `bb prepl-eval`."
:depends [-check-nostrand]
:task (apply nos/nos! "preplserver/start" *command-line-args*)}
prepl-eval
{:doc "Eval one form against the running prepl server and print the structured reply maps.
Usage: bb prepl-eval '(+ 1 2)' or bb prepl-eval :port 5560 '(+ 1 2)'.
Global defs persist across calls (Vars are interned in the runtime)."
:task (nos/prepl-eval! *command-line-args*)}
;; ============================================================
;; Unity dual-runtime regression
;; ============================================================
coexist-noise
{:doc "Headless Editor-runtime regression on unity-examples/magic-unity-coexist: one package, both Clojure runtimes, MAGIC_RUNTIME_IN_EDITOR selecting between them.
`bb coexist-noise` runs both states; `bb coexist-noise clojure-clr` / `bb coexist-noise magic` runs one. Every state must be silent and report its own runtime; details in magic.coexist/coexist-noise!.
Needs Unity 2022.3.62f3 with no GUI editor holding the project."
:requires ([magic.coexist :as coexist])
:task (coexist/coexist-noise! (first *command-line-args*))}
;; ============================================================
;; Hygiene + release
;; ============================================================
clean
{:doc "Remove bin/ directories and magic-compiler/bootstrap/."
:task (shell "dotnet build -t:Clean")}
outdated
{:doc "Report outdated dependencies (GitHub Actions via antq, NuGet via dotnet)."
:requires ([magic.release :as release])
:task (release/outdated!)}
verify-dist
{:doc "Smoke-test the built dist with `nos version`."
:requires ([magic.release :as release])
:task (release/verify-dist!)}
release-tarball
{:doc "Build the nos release tarball under target/ and smoke-test it.
Run by the release workflow on a tag push."
:requires ([magic.release :as release])
:depends [build]
:task (release/release-tarball!)}
tag
{:doc "Verify dist, then tag from version.edn and push."
:requires ([magic.release :as release])
:depends [verify-dist]
:task (release/tag!)}}}