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
|
||||||
|
|
@ -44,8 +44,8 @@
|
||||||
paths)))
|
paths)))
|
||||||
|
|
||||||
#_(merge-default-deps '{:deps {medley/medley nil}
|
#_(merge-default-deps '{:deps {medley/medley nil}
|
||||||
:aliases {:foo {medley/medley nil}}}
|
:aliases {:foo {medley/medley nil}}}
|
||||||
'{medley/medley {:mvn/version "1.3.0"}})
|
'{medley/medley {:mvn/version "1.3.0"}})
|
||||||
|
|
||||||
;;;; end merge edn files
|
;;;; end merge edn files
|
||||||
|
|
||||||
|
|
@ -66,31 +66,35 @@
|
||||||
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)
|
||||||
;; paths are added manually above
|
(and (:aliases deps-map)
|
||||||
;; extra-paths are added as :paths in tasks
|
aliases))]
|
||||||
:paths
|
(when need-deps?
|
||||||
:tasks :raw :min-bb-version))]
|
(let [deps-map (dissoc deps-map
|
||||||
(binding [*print-namespace-maps* false]
|
;; paths are added manually above
|
||||||
(let [deps-map (assoc-in deps-map [:aliases :org.babashka/defaults]
|
;; extra-paths are added as :paths in tasks
|
||||||
{:replace-paths [] ;; babashka sets paths manually
|
:paths :tasks :raw :file :deps-root
|
||||||
:classpath-overrides (cond->
|
:min-bb-version)]
|
||||||
'{org.clojure/clojure ""
|
(binding [*print-namespace-maps* false]
|
||||||
org.clojure/spec.alpha ""}
|
(let [deps-map (assoc-in deps-map [:aliases :org.babashka/defaults]
|
||||||
;; only remove core specs when they are not mentioned in deps map
|
{:replace-paths [] ;; babashka sets paths manually
|
||||||
(not (str/includes? (str deps-map) "org.clojure/core.specs.alpha"))
|
:classpath-overrides (cond->
|
||||||
(assoc 'org.clojure/core.specs.alpha ""))})
|
'{org.clojure/clojure ""
|
||||||
args (list "-Srepro" ;; do not include deps.edn from user config
|
org.clojure/spec.alpha ""}
|
||||||
"-Spath" "-Sdeps" (str deps-map)
|
;; only remove core specs when they are not mentioned in deps map
|
||||||
"-Sdeps-file" "") ;; we reset deps file so the local deps.edn isn't used
|
(not (str/includes? (str deps-map) "org.clojure/core.specs.alpha"))
|
||||||
args (if force (cons "-Sforce" args) args)
|
(assoc 'org.clojure/core.specs.alpha ""))})
|
||||||
args (concat args [(str "-A:" (str/join ":" (cons ":org.babashka/defaults" aliases)))])
|
args (list "-Srepro" ;; do not include deps.edn from user config
|
||||||
cp (with-out-str (binding [deps/*env* env
|
"-Spath" "-Sdeps" (str deps-map)
|
||||||
deps/*extra-env* extra-env]
|
"-Sdeps-file" "") ;; we reset deps file so the local deps.edn isn't used
|
||||||
(apply deps/-main args)))
|
args (if force (cons "-Sforce" args) args)
|
||||||
cp (str/trim cp)
|
args (concat args [(str "-A:" (str/join ":" (cons ":org.babashka/defaults" aliases)))])
|
||||||
cp (str/replace cp (re-pattern (str cp/path-sep "+$")) "")]
|
cp (with-out-str (binding [deps/*env* env
|
||||||
(cp/add-classpath cp))))))
|
deps/*extra-env* extra-env]
|
||||||
|
(apply deps/-main args)))
|
||||||
|
cp (str/trim cp)
|
||||||
|
cp (str/replace cp (re-pattern (str cp/path-sep "+$")) "")]
|
||||||
|
(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