Fixes for issue reported by @thiagokokada

This commit is contained in:
Michiel Borkent 2021-12-27 21:31:13 +01:00
parent ec7a6785d9
commit 1912b921df
3 changed files with 13 additions and 14 deletions

View file

@ -60,18 +60,16 @@
([deps-map] (add-deps deps-map nil))
([deps-map {:keys [:aliases :env :extra-env :force]}]
(when-let [paths (:paths deps-map)]
(let [paths (let [deps-root (:deps-root @bb-edn)
deps-root (fs/absolutize deps-root)
;; cwd (fs/absolutize ".")
;; rel (fs/relativize cwd f)
paths (mapv #(str (fs/file deps-root %)) paths)]
(let [paths (if-let [deps-root (:deps-root @bb-edn)]
(let [deps-root (fs/absolutize deps-root)
paths (mapv #(str (fs/file deps-root %)) paths)]
paths)
paths)]
(cp/add-classpath (str/join cp/path-sep paths))))
(when-let [deps-map (not-empty (dissoc deps-map
;; paths are added manually above
;; extra-paths are added as :paths in tasks
:paths
;; extra-paths are transformed to :deps in task handling
:extra-paths
:tasks :raw :min-bb-version))]
(binding [*print-namespace-maps* false]
(let [deps-map (assoc-in deps-map [:aliases :org.babashka/defaults]

View file

@ -920,17 +920,19 @@ Use bb run --help to show this help output.
(defn main [& args]
(let [[args global-opts] (parse-global-opts args)
bb-edn-file (or (:config global-opts)
config (:config global-opts)
bb-edn-file (or config
"bb.edn")
bb-edn (when (fs/exists? bb-edn-file)
(let [raw-string (slurp bb-edn-file)
edn (edn/read-string raw-string)
edn (assoc edn
:raw raw-string
:file bb-edn-file
:deps-root
(or (:deps-root global-opts)
(str (fs/parent bb-edn-file))))]
:file bb-edn-file)
edn (if-let [deps-root (or (:deps-root global-opts)
(some-> config fs/parent))]
(assoc edn :deps-root deps-root)
edn)]
(vreset! common/bb-edn edn)))
min-bb-version (:min-bb-version bb-edn)]
(when min-bb-version

View file

@ -7,8 +7,7 @@
[babashka.test-utils :as test-utils]
[clojure.edn :as edn]
[clojure.string :as str]
[clojure.test :as test :refer [deftest is testing]]
[sci.core :as sci]))
[clojure.test :as test :refer [deftest is testing]]))
(defn bb [& args]
(let [args (map str args)