This commit is contained in:
Michiel Borkent 2022-11-30 13:16:31 +01:00
parent d12b503b8a
commit 71c819a647
2 changed files with 10 additions and 2 deletions

View file

@ -63,7 +63,7 @@
:lib-tests
{:extra-paths ["process/src" "process/test" "test-resources/lib_tests"]
:extra-deps {org.clj-commons/clj-http-lite {:mvn/version "0.4.392"}
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
#_#_org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
:sha "0dec1f88cbde74a0470b454396f09a03adb4ae39"}
lambdaisland/regal {:mvn/version "0.0.143"}
cprop/cprop {:mvn/version "0.1.16"}

View file

@ -824,7 +824,7 @@ Use bb run --help to show this help output.
(assoc core-extras
'load-file (sci-copy-vars/new-var 'load-file load-file*))))
:features #{:bb :clj}
:classes @classes/class-map
:classes classes/class-map*
:imports classes/imports
:load-fn load-fn
;; :readers core/data-readers
@ -839,6 +839,9 @@ Use bb run --help to show this help output.
(def sci-ctx (new-sci-ctx))
#_(sci/binding [core/warn-on-reflection @core/warn-on-reflection]
(sci/eval-form sci-ctx '(require '[clojure.spec.alpha])))
(defn exec [cli-opts]
(binding [*unrestricted* true]
(sci/binding [core/warn-on-reflection @core/warn-on-reflection
@ -990,6 +993,11 @@ Use bb run --help to show this help output.
;; execute code
(sci/binding [sci/file abs-path]
(try
(run! (fn [s]
(sci/add-class! sci-ctx s
(Class/forName (str s))))
(when features/java-net-http?
classes/java-net-http-classes))
;; when evaluating expression(s), add in repl-requires so things like
;; pprint and dir are available
(sci/eval-form sci-ctx `(apply require (quote ~clojure-main/repl-requires)))