reader: #?@ empty splice fix (nil→@[]), #? nil→:jolt/skip, map reader handles #_/#?@ in K/V evaluator: unwrap-meta-name helper, deftype interns ->Name too, dot-suffix fix core: comment/prefer-method stubs, *unchecked-math*/*clojure-version* dynamic vars
1.7 KiB
1.7 KiB
| name | description |
|---|---|
| jpm-build | Build and debug Janet projects using jpm. Covers project.janet structure, common build errors, and native compilation with create-executable. |
JPM Build & Debug
Build Commands
jpm build # Compile and link executable → build/jolt
jpm test # Run all tests
jpm deps # Show dependencies
project.janet Structure
(declare-project
:name "jolt"
:description "...")
(declare-source
:source @["src"]) # Source directories
(declare-executable
:name "jolt" # Output binary name
:entry "src/jolt/main.janet") # RELATIVE TO PROJECT ROOT, not source dirs
Common Pitfalls
Entry path is relative to project root
Even though declare-source lists @["src"], the :entry in declare-executable must include src/ prefix. jpm's create-executable calls dofile source with the raw entry string.
main function required for native compilation
create-executable extracts a main function from the entry file's environment. Top-level code runs during dofile and interferes with image generation. Error: "expected integer key for keyword in range [0, 5), got nil".
Fix: Wrap startup code in (defn main [&] ...).
(defn main [&]
(print "REPL started")
;; ... REPL loop ...
)
LSP false positives
Clojure LSP misidentifies .janet files. Ignore all diagnostics — they don't affect build or test results.
Debugging Build Failures
- Check entry path includes
src/prefix - Check entry file has
(defn main [&] ...)wrapping top-level code - Run
jpm testto verify code works before native compilation jpm buildproduces no output on success — check exit code only