parent
890877fcfd
commit
34f9997df4
3 changed files with 41 additions and 28 deletions
2
sci
2
sci
|
|
@ -1 +1 @@
|
||||||
Subproject commit f29089b68e2e7d41e9491be0c1d7c48e1b9691e7
|
Subproject commit aaf5821f8c084d6301c96da88f05c570bffcc84d
|
||||||
|
|
@ -66,11 +66,15 @@
|
||||||
paths)
|
paths)
|
||||||
paths)]
|
paths)]
|
||||||
(cp/add-classpath (str/join cp/path-sep paths))))
|
(cp/add-classpath (str/join cp/path-sep paths))))
|
||||||
(when-let [deps-map (not-empty (dissoc deps-map
|
(let [need-deps? (or (:deps deps-map)
|
||||||
|
(and (:aliases deps-map)
|
||||||
|
aliases))]
|
||||||
|
(when need-deps?
|
||||||
|
(let [deps-map (dissoc deps-map
|
||||||
;; paths are added manually above
|
;; paths are added manually above
|
||||||
;; extra-paths are added as :paths in tasks
|
;; extra-paths are added as :paths in tasks
|
||||||
:paths
|
:paths :tasks :raw :file :deps-root
|
||||||
:tasks :raw :min-bb-version))]
|
:min-bb-version)]
|
||||||
(binding [*print-namespace-maps* false]
|
(binding [*print-namespace-maps* false]
|
||||||
(let [deps-map (assoc-in deps-map [:aliases :org.babashka/defaults]
|
(let [deps-map (assoc-in deps-map [:aliases :org.babashka/defaults]
|
||||||
{:replace-paths [] ;; babashka sets paths manually
|
{:replace-paths [] ;; babashka sets paths manually
|
||||||
|
|
@ -90,7 +94,7 @@
|
||||||
(apply deps/-main args)))
|
(apply deps/-main args)))
|
||||||
cp (str/trim cp)
|
cp (str/trim cp)
|
||||||
cp (str/replace cp (re-pattern (str cp/path-sep "+$")) "")]
|
cp (str/replace cp (re-pattern (str cp/path-sep "+$")) "")]
|
||||||
(cp/add-classpath cp))))))
|
(cp/add-classpath cp))))))))
|
||||||
|
|
||||||
(def deps-namespace
|
(def deps-namespace
|
||||||
{'add-deps (sci/copy-var add-deps dns)
|
{'add-deps (sci/copy-var add-deps dns)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
[babashka.impl.common :as common]
|
[babashka.impl.common :as common]
|
||||||
[babashka.main :as main]
|
[babashka.main :as main]
|
||||||
[babashka.test-utils :as test-utils]
|
[babashka.test-utils :as test-utils]
|
||||||
|
[borkdude.deps]
|
||||||
[clojure.edn :as edn]
|
[clojure.edn :as edn]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[clojure.test :as test :refer [deftest is testing]]))
|
[clojure.test :as test :refer [deftest is testing]]))
|
||||||
|
|
@ -362,3 +363,11 @@
|
||||||
(is (= 1 (count entries)))
|
(is (= 1 (count entries)))
|
||||||
(is (= (fs/parent config) (fs/parent entry)))
|
(is (= (fs/parent config) (fs/parent entry)))
|
||||||
(is (str/ends-with? entry "src"))))))
|
(is (str/ends-with? entry "src"))))))
|
||||||
|
|
||||||
|
(deftest without-deps-test
|
||||||
|
(when-not test-utils/native?
|
||||||
|
(with-redefs [borkdude.deps/-main (fn [& _]
|
||||||
|
(throw (ex-info "This ain't allowed!" {})))]
|
||||||
|
(testing "bb.edn without :deps should not require deps.clj"
|
||||||
|
(test-utils/with-config '{:tasks {a 1}}
|
||||||
|
(bb "-e" "(+ 1 2 3)"))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue