Pod namespaces come before namespaces from source
This commit is contained in:
parent
0a55554bb8
commit
9ed705f8db
2 changed files with 41 additions and 34 deletions
|
|
@ -773,22 +773,19 @@ Use bb run --help to show this help output.
|
||||||
_ (when jar
|
_ (when jar
|
||||||
(cp/add-classpath jar))
|
(cp/add-classpath jar))
|
||||||
load-fn (fn [{:keys [:namespace :reload]}]
|
load-fn (fn [{:keys [:namespace :reload]}]
|
||||||
(or (when-let [{:keys [:loader]}
|
(let [{:keys [loader]}
|
||||||
@cp/cp-state]
|
@cp/cp-state]
|
||||||
(if ;; ignore built-in namespaces when uberscripting, unless with :reload
|
(or
|
||||||
|
(when ;; ignore built-in namespaces when uberscripting, unless with :reload
|
||||||
(and uberscript
|
(and uberscript
|
||||||
(not reload)
|
(not reload)
|
||||||
(or (contains? namespaces namespace)
|
(or (contains? namespaces namespace)
|
||||||
(contains? sci-namespaces/namespaces namespace)))
|
(contains? sci-namespaces/namespaces namespace)))
|
||||||
""
|
"")
|
||||||
(when-let [res (cp/source-for-namespace loader namespace nil)]
|
;; pod namespaces go before namespaces from source,
|
||||||
(if uberscript
|
;; unless reload is used
|
||||||
(do (swap! uberscript-sources conj (:source res))
|
(when-not reload
|
||||||
(uberscript/uberscript {:ctx @common/ctx
|
(when-let [pod (get @pod-namespaces namespace)]
|
||||||
:expressions [(:source res)]})
|
|
||||||
{})
|
|
||||||
res))))
|
|
||||||
(if-let [pod (get @pod-namespaces namespace)]
|
|
||||||
(if uberscript
|
(if uberscript
|
||||||
(do
|
(do
|
||||||
(swap! uberscript-sources conj
|
(swap! uberscript-sources conj
|
||||||
|
|
@ -798,7 +795,15 @@ Use bb run --help to show this help output.
|
||||||
(dissoc (:opts pod)
|
(dissoc (:opts pod)
|
||||||
:version :metadata)))
|
:version :metadata)))
|
||||||
{})
|
{})
|
||||||
(pods/load-pod (:pod-spec pod) (:opts pod)))
|
(pods/load-pod (:pod-spec pod) (:opts pod)))))
|
||||||
|
(when loader
|
||||||
|
(when-let [res (cp/source-for-namespace loader namespace nil)]
|
||||||
|
(if uberscript
|
||||||
|
(do (swap! uberscript-sources conj (:source res))
|
||||||
|
(uberscript/uberscript {:ctx @common/ctx
|
||||||
|
:expressions [(:source res)]})
|
||||||
|
{})
|
||||||
|
res)))
|
||||||
(case namespace
|
(case namespace
|
||||||
clojure.spec.alpha
|
clojure.spec.alpha
|
||||||
(binding [*out* *err*]
|
(binding [*out* *err*]
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
(bb (pr-str `(do (babashka.deps/add-deps '{:deps {babashka/process {:git/url "https://github.com/babashka/process" :sha "4c6699d06b49773d3e5c5b4c11d3334fb78cc996"}}}
|
(bb (pr-str `(do (babashka.deps/add-deps '{:deps {babashka/process {:git/url "https://github.com/babashka/process" :sha "4c6699d06b49773d3e5c5b4c11d3334fb78cc996"}}}
|
||||||
{:force true
|
{:force true
|
||||||
:env {"PATH" (System/getenv "PATH")
|
:env {"PATH" (System/getenv "PATH")
|
||||||
|
"JAVA_HOME" (System/getenv "JAVA_HOME")
|
||||||
"GITLIBS" ~(str libs-dir)}}) nil)))
|
"GITLIBS" ~(str libs-dir)}}) nil)))
|
||||||
(bb (pr-str `(do (babashka.deps/add-deps '{:deps {babashka/process {:git/url "https://github.com/babashka/process" :sha "4c6699d06b49773d3e5c5b4c11d3334fb78cc996"}}}
|
(bb (pr-str `(do (babashka.deps/add-deps '{:deps {babashka/process {:git/url "https://github.com/babashka/process" :sha "4c6699d06b49773d3e5c5b4c11d3334fb78cc996"}}}
|
||||||
{:force true
|
{:force true
|
||||||
|
|
@ -86,6 +87,7 @@ true
|
||||||
libs-dir2 (fs/file tmp-dir ".gitlibs2")
|
libs-dir2 (fs/file tmp-dir ".gitlibs2")
|
||||||
template (pr-str '(do (babashka.deps/clojure ["-Sforce" "-Spath" "-Sdeps" "{:deps {babashka/process {:git/url \"https://github.com/babashka/process\" :sha \"4c6699d06b49773d3e5c5b4c11d3334fb78cc996\"}}}"]
|
template (pr-str '(do (babashka.deps/clojure ["-Sforce" "-Spath" "-Sdeps" "{:deps {babashka/process {:git/url \"https://github.com/babashka/process\" :sha \"4c6699d06b49773d3e5c5b4c11d3334fb78cc996\"}}}"]
|
||||||
{:out :string :env-key {"PATH" (System/getenv "PATH")
|
{:out :string :env-key {"PATH" (System/getenv "PATH")
|
||||||
|
"JAVA_HOME" (System/getenv "JAVA_HOME")
|
||||||
"GITLIBS" :gitlibs}}) nil))]
|
"GITLIBS" :gitlibs}}) nil))]
|
||||||
(bb (-> template (str/replace ":gitlibs" (pr-str (str libs-dir)))
|
(bb (-> template (str/replace ":gitlibs" (pr-str (str libs-dir)))
|
||||||
(str/replace ":env-key" ":env")))
|
(str/replace ":env-key" ":env")))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue