Add prepare subcommand (#1229)

* Add prepare subcommand

Downloads deps & pods, caches pod metadata, and then exits

* Add prepare subcommand to CHANGELOG

Co-authored-by: Michiel Borkent <michielborkent@gmail.com>
This commit is contained in:
Wes Morgan 2022-04-05 03:04:38 -06:00 committed by GitHub
parent d2278835f1
commit 211757d5a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -5,8 +5,10 @@ For a list of breaking changes, check [here](#breaking-changes).
A preview of the next release can be installed from A preview of the next release can be installed from
[babashka-dev-builds](https://github.com/babashka/babashka-dev-builds). [babashka-dev-builds](https://github.com/babashka/babashka-dev-builds).
## 0.8.1 (TBD) =======
## Unreleased
- Add `prepare` subcommand to download deps & pods and cache pod metadata
- [#1041](https://github.com/babashka/babashka/issues/1041): Improve error message when regex literal in EDN config - [#1041](https://github.com/babashka/babashka/issues/1041): Improve error message when regex literal in EDN config
## 0.8.0 (2022-04-04) ## 0.8.0 (2022-04-04)

View file

@ -115,7 +115,8 @@
"socket-repl" "socket-repl"
"nrepl-server" "nrepl-server"
"describe" "describe"
"print-deps") true "print-deps"
"prepare") true
false)) false))
(defn print-error [& msgs] (defn print-error [& msgs]
@ -175,6 +176,7 @@ Packaging:
uberscript <file> [eval-opt] Collect all required namespaces from the classpath into a single file. Accepts additional eval opts, like `-m`. uberscript <file> [eval-opt] Collect all required namespaces from the classpath into a single file. Accepts additional eval opts, like `-m`.
uberjar <jar> [eval-opt] Similar to uberscript but creates jar file. uberjar <jar> [eval-opt] Similar to uberscript but creates jar file.
prepare Download deps & pods defined in bb.edn and cache their metadata. Only an optimization, this will happen on demand when needed.
In- and output flags (only to be used with -e one-liners): In- and output flags (only to be used with -e one-liners):
@ -621,6 +623,10 @@ Use bb run --help to show this help output.
:command-line-args (next options)) :command-line-args (next options))
("--print-deps") ("--print-deps")
(parse-print-deps-opts opts-map (next options)) (parse-print-deps-opts opts-map (next options))
("--prepare")
(let [options (next options)]
(recur (next options)
(assoc opts-map :prepare true)))
;; fallback ;; fallback
(if (and opts-map (if (and opts-map
(some opts-map [:file :jar :socket-repl :expressions :main :run])) (some opts-map [:file :jar :socket-repl :expressions :main :run]))
@ -715,7 +721,7 @@ Use bb run --help to show this help output.
:main :uberscript :describe? :main :uberscript :describe?
:jar :uberjar :clojure :jar :uberjar :clojure
:doc :run :list-tasks :doc :run :list-tasks
:print-deps]} :print-deps :prepare]}
cli-opts cli-opts
_ (when debug (vreset! common/debug true)) _ (when debug (vreset! common/debug true))
_ (do ;; set properties _ (do ;; set properties
@ -883,6 +889,7 @@ Use bb run --help to show this help output.
uberjar [nil 0] uberjar [nil 0]
list-tasks [(tasks/list-tasks sci-ctx) 0] list-tasks [(tasks/list-tasks sci-ctx) 0]
print-deps [(print-deps/print-deps (:print-deps-format cli-opts)) 0] print-deps [(print-deps/print-deps (:print-deps-format cli-opts)) 0]
prepare [nil 0]
uberscript uberscript
[nil (do (uberscript/uberscript {:ctx sci-ctx [nil (do (uberscript/uberscript {:ctx sci-ctx
:expressions expressions}) :expressions expressions})