[#720, #733] print-deps (#958)

This commit is contained in:
Michiel Borkent 2021-07-27 11:29:00 +02:00 committed by GitHub
parent a9e445e5a1
commit 84430c60f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 158 additions and 2 deletions

View file

@ -0,0 +1,5 @@
{:lint-as
{rewrite-clj.zip/subedit-> clojure.core/->
rewrite-clj.zip/subedit->> clojure.core/->>
rewrite-clj.zip/edit-> clojure.core/->
rewrite-clj.zip/edit->> clojure.core/->>}}

View file

@ -0,0 +1,97 @@
{:paths ["src" "feature-xml" "feature-core-async"
"feature-yaml" "feature-csv" "feature-transit"
"feature-java-time" "feature-java-nio"
"feature-httpkit-client" "feature-httpkit-server"
"feature-lanterna"
"feature-core-match"
"feature-hiccup"
"feature-test-check"
"feature-spec-alpha"
"feature-rewrite-clj"
"feature-selmer"
"pods/src"
"babashka.nrepl/src"
"depstar/src" "process/src"
"deps.clj/src" "deps.clj/resources"
"resources" "sci/resources"],
:deps {org.clojure/clojure {:mvn/version "1.11.0-alpha1"},
borkdude/sci {:local/root "sci"}
babashka/babashka.curl {:local/root "babashka.curl"}
babashka/fs {:local/root "fs"}
borkdude/graal.locking {:mvn/version "0.0.2"},
org.clojure/core.async {:mvn/version "1.3.618"},
org.clojure/tools.cli {:mvn/version "1.0.206"},
org.clojure/data.csv {:mvn/version "1.0.0"},
cheshire/cheshire {:mvn/version "5.10.1"}
org.clojure/data.xml {:mvn/version "0.2.0-alpha6"}
clj-commons/clj-yaml {:mvn/version "0.7.107"}
com.cognitect/transit-clj {:mvn/version "1.0.324"}
org.clojure/test.check {:mvn/version "1.1.0"}
nrepl/bencode {:mvn/version "1.1.0"}
seancorfield/next.jdbc {:mvn/version "1.1.610"}
org.postgresql/postgresql {:mvn/version "42.2.18"}
org.hsqldb/hsqldb {:mvn/version "2.5.1"}
datascript/datascript {:mvn/version "1.0.1"}
http-kit/http-kit {:mvn/version "2.5.3"}
babashka/clojure-lanterna {:mvn/version "0.9.8-SNAPSHOT"}
org.clojure/core.match {:mvn/version "1.0.0"}
hiccup/hiccup {:mvn/version "2.0.0-alpha2"}
rewrite-clj/rewrite-clj {:mvn/version "1.0.644-alpha"}
selmer/selmer {:mvn/version "1.12.44"}
com.taoensso/timbre {:mvn/version "5.1.2"}
org.clojure/tools.logging {:mvn/version "1.1.0"}}
:aliases {:babashka/dev
{:main-opts ["-m" "babashka.main"]}
:profile
{:extra-deps
{com.clojure-goes-fast/clj-async-profiler {:mvn/version "0.5.0"}}
:extra-paths ["test"]
:jvm-opts ["-Djdk.attach.allowAttachSelf"
"-Dclojure.compiler.direct-linking=true"]
:main-opts ["-m" "babashka.profile"]}
:lib-tests
{:extra-paths ["process/src" "process/test"]
:extra-deps {babashka/clj-http-lite
{:git/url "https://github.com/babashka/clj-http-lite"
:sha "f44ebe45446f0f44f2b73761d102af3da6d0a13e"}
borkdude/spartan.spec {:git/url "https://github.com/borkdude/spartan.spec"
:sha "16f7eec4b6589c77c96c9fcf989f78fffcee7c4c"}
lambdaisland/regal {:git/url "https://github.com/lambdaisland/regal"
:sha "f902d2c43121f9e1c48603d6eb99f5900eb6a9f6"}
weavejester/medley {:git/url "https://github.com/weavejester/medley"
:sha "a4e5fb5383f5c0d83cb2d005181a35b76d8a136d"}
cprop/cprop {:mvn/version "0.1.16"}
comb/comb {:mvn/version "0.1.1"}
mvxcvi/arrangement {:mvn/version "1.2.0"}
org.clojure/data.zip {:mvn/version "1.0.0"}
clojure-csv/clojure-csv {:mvn/version "2.0.2"}
org.clojure/math.combinatorics {:mvn/version "0.1.6"}
doric/doric {:mvn/version "0.9.0"}
henryw374/cljc.java-time
{:git/url "https://github.com/henryw374/cljc.java-time.git"
:sha "e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c"}
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.1"}
aero/aero {:mvn/version "1.1.6"}
org.clojure/data.generators {:mvn/version "1.0.0"}
honeysql/honeysql {:mvn/version "1.0.444"}
com.github.seancorfield/honeysql {:mvn/version "2.0.0-rc2"}
minimallist/minimallist {:mvn/version "0.0.6"}
circleci/bond {:mvn/version "0.4.0"}
version-clj/version-clj {:mvn/version "2.0.1"}
gaka/gaka {:mvn/version "0.3.0"}
failjure/failjure {:mvn/version "2.1.1"}
io.helins/binf {:mvn/version "1.1.0-beta0"}
rm-hull/jasentaa {:mvn/version "0.2.5"}
slingshot/slingshot {:mvn/version "0.12.2"}
io.replikativ/hasch {:mvn/version "0.3.7"}
com.grammarly/omniconf {:mvn/version "0.4.3"}
crispin/crispin {:mvn/version "0.3.8"}
org.clojure/data.json {:mvn/version "2.4.0"}
amperity/vault-clj {:mvn/version "1.0.4"}}
:classpath-overrides {org.clojure/clojure nil
org.clojure/spec.alpha nil
org.clojure/core.specs.alpha nil}}
:clj-nvd
{:extra-deps {clj-nvd/clj-nvd {:git/url "https://github.com/miikka/clj-nvd.git"
:sha "f2ec98699e057a379baf170cb49cf7ad76874a70"}}
:main-opts ["-m" "clj-nvd.core"]}}}

View file

@ -43,6 +43,7 @@ args=( "-jar" "$BABASHKA_JAR"
"-H:+ReportExceptionStackTraces"
"-J-Dborkdude.dynaload.aot=true"
"-H:IncludeResources=BABASHKA_VERSION"
"-H:IncludeResources=META-INF/babashka/.*"
"-H:IncludeResources=SCI_VERSION"
"-H:ReflectionConfigurationFiles=reflection.json"
"--initialize-at-build-time"

View file

@ -0,0 +1,34 @@
(ns babashka.impl.print-deps
(:require
[babashka.impl.common :as common]
[babashka.impl.deps :as deps]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.pprint :as pp]
[clojure.string :as str]))
(defn print-deps [deps-format]
(let [deps (-> (io/resource "META-INF/babashka/deps.edn")
slurp
edn/read-string)
deps (:deps deps)
deps (assoc deps
'babashka/fs {:mvn/version "0.0.5"}
'babashka/babashka.curl {:mvn/version "0.0.3"})
deps (dissoc deps
'borkdude/sci
'borkdude/graal.locking
'org.postgresql/postgresql
'babashka/clojure-lanterna
'seancorfield/next.jdbc
'datascript/datascript)
bb-edn-deps (:deps @common/bb-edn)
deps (merge deps bb-edn-deps)
paths (:paths @common/bb-edn)
deps {:deps deps}
deps (cond-> deps
(seq paths) (assoc :paths paths))]
(case deps-format
("deps" nil) (binding [*print-namespace-maps* false]
(pp/pprint deps))
("classpath") (println (str/trim (with-out-str (deps/clojure ["-Spath" "-Sdeps" deps])))))))

View file

@ -28,6 +28,7 @@
tools-logging-impl-namespace]]
[babashka.impl.pods :as pods]
[babashka.impl.pprint :refer [pprint-namespace]]
[babashka.impl.print-deps :as print-deps]
[babashka.impl.process :refer [process-namespace]]
[babashka.impl.protocols :refer [protocols-namespace]]
[babashka.impl.proxy :refer [proxy-fn]]
@ -104,7 +105,8 @@
"repl"
"socket-repl"
"nrepl-server"
"describe") true
"describe"
"print-deps") true
false))
(defn print-error [& msgs]
@ -452,6 +454,19 @@ Use bb run --help to show this help output.
(assoc opts-map :run fst :command-line-args (next args))))
opts-map)))
(defn- parse-print-deps-opts
[opts-map args]
(loop [opts-map (assoc opts-map :print-deps true)
args (seq args)]
(if args
(let [fst (first args)]
(case fst
"--format"
(recur (assoc opts-map :print-deps-format (second args))
(nnext args))
opts-map))
opts-map)))
(defn parse-args [args opts-map]
(loop [options args
opts-map opts-map]
@ -571,6 +586,8 @@ Use bb run --help to show this help output.
("--tasks")
(assoc opts-map :list-tasks true
:command-line-args (next options))
("--print-deps")
(parse-print-deps-opts opts-map (next options))
;; fallback
(if (and opts-map
(some opts-map [:file :jar :socket-repl :expressions :main :run]))
@ -645,7 +662,8 @@ Use bb run --help to show this help output.
:debug :classpath :force?
:main :uberscript :describe?
:jar :uberjar :clojure
:doc :run :list-tasks]}
:doc :run :list-tasks
:print-deps]}
cli-opts
_ (when debug (vreset! common/debug true))
_ (do ;; set properties
@ -769,6 +787,7 @@ Use bb run --help to show this help output.
nrepl [(start-nrepl! nrepl sci-ctx) 0]
uberjar [nil 0]
list-tasks [(tasks/list-tasks sci-ctx) 0]
print-deps [(print-deps/print-deps (:print-deps-format cli-opts)) 0]
expressions
(sci/binding [sci/file abs-path]
(try