diff --git a/CHANGELOG.md b/CHANGELOG.md index f6e94fb3..c7c958dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,8 +17,9 @@ A preview of the next release can be installed from - Bump integrant CI tests - [#1600](https://github.com/babashka/babashka/issues/1600): use pagesize of 64K on linux aarch64, so it works on Asahi linux - Expose `selmer.parser/resolve-arg` -- #1610: expose `babashka.http-client.websocket` namespace +- [#1610](https://github.com/babashka/babashka/issues/1610): expose `babashka.http-client.websocket` namespace - Bump `babashka.http-client` to `0.4.14` +- [#1568](https://github.com/babashka/babashka/issues/1568): warn when task overrides built-in command ## 1.3.182 (2023-07-20) diff --git a/resources/META-INF/babashka/deps.edn b/resources/META-INF/babashka/deps.edn index 7f7aab15..4dcd255e 100644 --- a/resources/META-INF/babashka/deps.edn +++ b/resources/META-INF/babashka/deps.edn @@ -31,7 +31,7 @@ org.clojure/data.csv {:mvn/version "1.0.0"}, cheshire/cheshire {:mvn/version "5.11.0"} org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} - clj-commons/clj-yaml {:mvn/version "1.0.26"} + clj-commons/clj-yaml {:mvn/version "1.0.27"} com.cognitect/transit-clj {:mvn/version "1.0.333"} org.clojure/test.check {:mvn/version "1.1.1"} nrepl/bencode {:mvn/version "1.1.0"} @@ -51,7 +51,7 @@ insn/insn {:mvn/version "0.5.2"} org.clojure/core.rrb-vector {:mvn/version "0.1.2"} org.babashka/cli {:mvn/version "0.7.51"} - org.babashka/http-client {:mvn/version "0.4.13"} + org.babashka/http-client {:mvn/version "0.4.14"} ;; native image bloat with ordered 1.5.10 org.flatland/ordered {:mvn/version "1.5.9"}} :aliases {:babashka/dev @@ -109,7 +109,7 @@ exoscale/coax {:mvn/version "1.0.0-alpha14"} orchestra/orchestra {:mvn/version "2021.01.01-1"} expound/expound {:mvn/version "0.8.10"} - integrant/integrant {:mvn/version "0.8.0"} + integrant/integrant {:git/url "https://github.com/weavejester/integrant", :git/sha "a9fd7c02bd7201f36344b47142badc3c3ef22f88"} com.stuartsierra/dependency {:mvn/version "1.0.0"} listora/again {:mvn/version "1.0.0"} org.clojure/tools.gitlibs {:mvn/version "2.4.172"} diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 54192d80..7bfa5395 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -56,6 +56,7 @@ [babashka.wait :refer [wait-namespace]] [clojure.edn :as edn] [clojure.java.io :as io] + [clojure.set :as set] [clojure.string :as str] [edamame.core :as edamame] [hf.depstar.uberjar :as uberjar] @@ -729,7 +730,14 @@ Use bb run --help to show this help output. ([options] (parse-opts options nil)) ([options opts-map] (let [opt (first options) - tasks (into #{} (map str) (keys (:tasks @common/bb-edn)))] + task-map (:tasks @common/bb-edn) + tasks (into #{} (map str) (keys task-map))] + (when-let [commands (seq (filter (fn [task] + (and (command? task) + (not (:override-builtin (get task-map (symbol task)))))) + tasks))] + (binding [*out* *err*] + (println "[babashka] WARNING: task(s)" (str/join ", " (map #(format "'%s'" %) commands)) "override built-in command(s). Use :override-builtin true to disable warning."))) (if-not opt opts-map ;; FILE > TASK > SUBCOMMAND (cond @@ -742,7 +750,6 @@ Use bb run --help to show this help output. (assoc opts-map :run opt :command-line-args (next options)) - (command? opt) (recur (cons (str "--" opt) (next options)) opts-map) diff --git a/test/babashka/bb_edn_test.clj b/test/babashka/bb_edn_test.clj index a565a0ac..24ab1a1d 100644 --- a/test/babashka/bb_edn_test.clj +++ b/test/babashka/bb_edn_test.clj @@ -8,7 +8,8 @@ [borkdude.deps] [clojure.edn :as edn] [clojure.string :as str] - [clojure.test :as test :refer [deftest is testing]])) + [clojure.test :as test :refer [deftest is testing]] + [babashka.test-utils :as tu])) (defn bb [& args] (let [args (map str args) @@ -531,3 +532,8 @@ even more stuff here\" (deftest non-existing-tasks-in-run-gives-exit-code-1 (is (thrown? Exception (bb "-Sdeps" "{:tasks {foo {:task (run (quote bar))}}}" "foo")))) + +(deftest warning-on-override-task + (when-not tu/native? + (binding [*out* *err*] + (is (str/includes? (with-out-str (bb "-Sdeps" "{:tasks {run {:task 1}}}" "run")) "'run' override")))))