deps: :jpm/module coordinates; the janet.* bridge autoloads jpm modules
The vendored spork/http is gone — jpm owns janet packages. In its place: - The janet.* bridge autoloads jpm-installed modules on first reference: janet.spork.http/server requires spork/http from the module path and caches its bindings (failures are negatively cached). Works for any module, in every mode, including inside net/server connection fibers. - deps.edn grows a :jpm/module coordinate: jolt-deps verifies the module is importable at resolve time, optionally running `jpm install` on the :jpm/install package once when it isn't, and otherwise fails with the install hint. Contributes no source roots. ring-app declares spork/http this way. Docs: README's interop section, docs/tools-deps.md (:jpm/module reference), and the ring-app README (including the jpm-version caveat for spork HEAD's .janet native sources, which older jpm rejects).
This commit is contained in:
parent
9aadbf42fd
commit
06e0899578
6 changed files with 106 additions and 556 deletions
|
|
@ -125,6 +125,32 @@
|
|||
)
|
||||
(rmrf gbase)
|
||||
|
||||
# --- :jpm/module deps: janet libraries installed through jpm -----------------
|
||||
# Verification only (jpm owns installation): an importable module passes and
|
||||
# contributes no roots; a missing one errors with the install hint. jpm/pm is
|
||||
# always importable wherever jpm itself runs (CI included).
|
||||
(do
|
||||
(def jbase (string (or (os/getenv "TMPDIR") "/tmp") "/jolt-deps-jpm-" (os/time)))
|
||||
(mkdirs (string jbase "/src"))
|
||||
(spit (string jbase "/deps.edn")
|
||||
`{:paths ["src"] :deps {janet/jpm-pm {:jpm/module "jpm/pm"}}}`)
|
||||
(def cwd (os/cwd))
|
||||
(os/cd jbase)
|
||||
(def roots (deps/resolve-deps "deps.edn" (string jbase "/jpm_tree")))
|
||||
(os/cd cwd)
|
||||
(check "jpm module dep resolves" true (not (nil? roots)))
|
||||
(check "jpm module contributes no roots" 1 (length roots))
|
||||
|
||||
(spit (string jbase "/deps.edn")
|
||||
`{:paths ["src"] :deps {janet/nope {:jpm/module "no/such-module-xyz"}}}`)
|
||||
(os/cd jbase)
|
||||
(def r (protect (deps/resolve-deps "deps.edn" (string jbase "/jpm_tree"))))
|
||||
(os/cd cwd)
|
||||
(check "missing jpm module errors" false (r 0))
|
||||
(check "error carries the install hint" true
|
||||
(not (nil? (string/find "jpm install" (string (r 1))))))
|
||||
(rmrf jbase))
|
||||
|
||||
(if (> fails 0)
|
||||
(error (string "deps-resolve-test: " fails " failing check(s)"))
|
||||
(print "\nAll deps-resolve tests passed!"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue