This commit is contained in:
Michiel Borkent 2021-03-19 12:14:04 +01:00
parent ca22e8fd04
commit 8f93826072
3 changed files with 15 additions and 4 deletions

View file

@ -57,9 +57,13 @@
then used to resolve dependencies in babashka."
([deps-map] (add-deps deps-map nil))
([deps-map {:keys [:aliases]}]
(let [args ["-Spath" "-Sdeps" (str deps-map)]
(let [deps-map (assoc-in deps-map [:aliases :org.babashka/remove-clojure]
'{:classpath-overrides {org.clojure/clojure ""
org.clojure/spec.alpha ""
org.clojure/core.specs.alpha ""}})
args ["-Spath" "-Sdeps" (str deps-map)]
args (cond-> args
aliases (conj (str "-A:" (str/join ":" aliases))))
aliases (conj (str "-A:" (str/join ":" (cons ":org.babashka/remove-clojure" aliases)))))
cp (with-out-str (apply deps/-main args))]
(cp/add-classpath cp))))

View file

@ -754,7 +754,9 @@ Use -- to separate script command line args from bb command line args.
(handle-sigint!)
(when-let [bb-edn @bb-edn]
(when-let [paths (:paths bb-edn)]
(cp/add-classpath (str/join cp/path-sep paths))))
(cp/add-classpath (str/join cp/path-sep paths)))
(when-let [deps (:deps bb-edn)]
(deps/add-deps {:deps deps})))
(if-let [dev-opts (System/getenv "BABASHKA_DEV")]
(let [{:keys [:n]} (if (= "true" dev-opts) {:n 1}
(edn/read-string dev-opts))

View file

@ -1,4 +1,7 @@
{:paths ["test-resources/bb-edn"]
{:paths ["test-resources/bb-edn"] ;; no-brainer to support this
:deps {medley/medley {:mvn/version "1.3.0"}} ;; no-brainer to support this
;; here comes the part that is currently uncertain
:tasks {:count-files {:task/type :shell
:args ["bash" "-c" "ls | wc -l"]}
:bash {:task/type :babashka
@ -40,6 +43,8 @@
,
;;;; context (not implemented)
;; the problem with this is the DSL nature which is very opiniated and
;; maybe not so nice to learn for people who only want to write Clojure
:put-answer-in-ctx {:type/task :babashka
:args [:eval-plus 1 2 3]
:out [:answer]}