From 2e3bd2d3f09f779ffa7816070f690e957f1780fe Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 12 May 2023 16:05:41 +0200 Subject: [PATCH] Bump deps.clj (#1556) --- .circleci/script/gen_ci.clj | 3 ++- deps.clj | 2 +- process | 2 +- src/babashka/deps.clj | 22 +++++++++------------- src/babashka/impl/deps.clj | 21 +++++++++++++-------- src/babashka/impl/print_deps.clj | 2 +- test/babashka/deps_test.clj | 26 +++++++++++++------------- 7 files changed, 40 insertions(+), 38 deletions(-) diff --git a/.circleci/script/gen_ci.clj b/.circleci/script/gen_ci.clj index ada76d05..d5ad25fa 100644 --- a/.circleci/script/gen_ci.clj +++ b/.circleci/script/gen_ci.clj @@ -81,7 +81,8 @@ :environment {:LEIN_ROOT "true" :BABASHKA_PLATFORM "linux" :GRAALVM_VERSION "22.3.1" - :GRAALVM_HOME graalvm-home} + :GRAALVM_HOME graalvm-home + :BABASHKA_TEST_ENV "jvm"} :resource_class "large" :steps (gen-steps diff --git a/deps.clj b/deps.clj index 564f97f7..647d40a7 160000 --- a/deps.clj +++ b/deps.clj @@ -1 +1 @@ -Subproject commit 564f97f75f95c1bfd8a606c97066df7015b19ffc +Subproject commit 647d40a7e682fdd225ed342825b3ea14a7c5f780 diff --git a/process b/process index 84919a6b..b23db511 160000 --- a/process +++ b/process @@ -1 +1 @@ -Subproject commit 84919a6bad41fc1d0e3f045cc54aab6174bbf4b5 +Subproject commit b23db511af22e9b0572bf6d032b1fe75bf9f00a1 diff --git a/src/babashka/deps.clj b/src/babashka/deps.clj index ea8daa59..f5c3ea8a 100644 --- a/src/babashka/deps.clj +++ b/src/babashka/deps.clj @@ -38,17 +38,13 @@ *out* @sci/out *err* @sci/err deps/*dir* (:dir opts) - deps/*env* (:env opts) - deps/*extra-env* (:extra-env opts) - deps/*process-fn* (fn - ([cmd] (pp/process* {:cmd cmd - :prev prev - :opts opts})) - ([cmd _] (pp/process* {:cmd cmd - :prev prev - :opts opts}))) - deps/*exit-fn* (fn - ([_]) - ([_exit-code msg] - (throw (Exception. msg))))] + deps/*aux-process-fn* (fn [{:keys [cmd out]}] + (pp/shell (assoc opts :out out :cmd cmd))) + deps/*clojure-process-fn* (fn [{:keys [cmd]}] + (pp/process* {:cmd cmd + :prev prev + :opts opts})) + deps/*exit-fn* (fn [{:keys [message]}] + (when message + (throw (Exception. message))))] (apply deps/-main cmd)))) diff --git a/src/babashka/impl/deps.clj b/src/babashka/impl/deps.clj index 77354320..f2db3e65 100644 --- a/src/babashka/impl/deps.clj +++ b/src/babashka/impl/deps.clj @@ -3,6 +3,7 @@ [babashka.fs :as fs] [babashka.impl.classpath :as cp] [babashka.impl.common :refer [bb-edn]] + [babashka.process :as process] [borkdude.deps :as deps] [clojure.string :as str] [sci.core :as sci])) @@ -80,8 +81,8 @@ (let [deps-map (assoc-in deps-map [:aliases :org.babashka/defaults] {:replace-paths [] ;; babashka sets paths manually :classpath-overrides (cond-> - '{org.clojure/clojure "" - org.clojure/spec.alpha ""} + '{org.clojure/clojure "" + org.clojure/spec.alpha ""} ;; only remove core specs when they are not mentioned in deps map (not (str/includes? (str deps-map) "org.clojure/core.specs.alpha")) (assoc 'org.clojure/core.specs.alpha ""))}) @@ -91,12 +92,16 @@ args (if force (cons "-Sforce" args) args) args (concat args [(str "-A:" (str/join ":" (cons ":org.babashka/defaults" aliases)))]) bindings (cond-> - {#'deps/*env* env - #'deps/*extra-env* extra-env - #'deps/*exit-fn* (fn - ([_]) - ([_exit-code msg] - (throw (Exception. msg))))} + {#'deps/*aux-process-fn* (fn [{:keys [cmd out]}] + (process/shell + {:cmd cmd + :out out + :env env + :dir (when deps-root (str deps-root)) + :extra-env extra-env})) + #'deps/*exit-fn* (fn [{:keys [message]}] + (when message + (throw (Exception. message))))} deps-root (assoc #'deps/*dir* (str deps-root))) cp (with-out-str (with-bindings bindings (apply deps/-main args))) diff --git a/src/babashka/impl/print_deps.clj b/src/babashka/impl/print_deps.clj index 6f1b4412..d727d45f 100644 --- a/src/babashka/impl/print_deps.clj +++ b/src/babashka/impl/print_deps.clj @@ -18,7 +18,7 @@ 'babashka/babashka.curl {:mvn/version "0.1.2"} 'babashka/babashka.core {:git/url "https://github.com/babashka/babashka.core" :git/sha "52a6037bd4b632bffffb04394fb4efd0cdab6b1e"} - 'babashka/process {:mvn/version "0.5.17"}) + 'babashka/process {:mvn/version "0.5.19"}) deps (dissoc deps 'borkdude/sci 'org.babashka/sci diff --git a/test/babashka/deps_test.clj b/test/babashka/deps_test.clj index 5b0169ea..56980e98 100644 --- a/test/babashka/deps_test.clj +++ b/test/babashka/deps_test.clj @@ -106,21 +106,21 @@ true (is (fs/exists? libs-dir2)))))) (deftest ^:windows-only win-clojure-test - (testing "GITLIBS can set location of .gitlibs dir" - (let [tmp-dir (fs/create-temp-dir) - libs-dir (fs/file tmp-dir ".gitlibs") - libs-dir2 (fs/file tmp-dir ".gitlibs2") + (testing "GITLIBS can set location of .gitlibs dir" + (let [tmp-dir (fs/create-temp-dir) + libs-dir (fs/file tmp-dir ".gitlibs") + libs-dir2 (fs/file tmp-dir ".gitlibs2") ; nested quotes need different escaping for Windows based on jvm/native test - escape-quote (if test-utils/native? "\\\\\"" "\\\"") - deps-map (str/join escape-quote [" \"{:deps {babashka/process {:git/url " - "https://github.com/babashka/process" " :sha " - "4c6699d06b49773d3e5c5b4c11d3334fb78cc996" "}}}\""]) - template (str "(do (babashka.deps/clojure [\"-Sforce\" \"-Spath\" \"-Sdeps\"" deps-map "] + escape-quote (if test-utils/native? "\\\\\"" "\\\"") + deps-map (str/join escape-quote [" \"{:deps {babashka/process {:git/url " + "https://github.com/babashka/process" " :sha " + "4c6699d06b49773d3e5c5b4c11d3334fb78cc996" "}}}\""]) + template (str "(do (babashka.deps/clojure [\"-Sforce\" \"-Spath\" \"-Sdeps\"" deps-map "] {:out :string :env-key {\"PATH\" (System/getenv \"PATH\") \"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"))) - (bb (-> template (str/replace ":gitlibs" (pr-str (str libs-dir2))) + (bb (-> template (str/replace ":gitlibs" (pr-str (str libs-dir2))) (str/replace ":env-key" ":extra-env"))) - (is (fs/exists? libs-dir)) - (is (fs/exists? libs-dir2))))) + (is (fs/exists? libs-dir)) + (is (fs/exists? libs-dir2)))))