borkdude.deps
- Port of https://github.com/clojure/brew-install/blob/1.11.1/src/main/resources/clojure/install/clojure in Clojure.*aux-process-fn*
- Invokesjava
with arguments to calculate classpath, etc.*clojure-process-fn*
- Invokesjava
with arguments toclojure.main
to start Clojure.*clojure-tools-download-fn*
- Can be dynamically rebound to customise the download of the Clojure tools.*dir*
- Directory in which deps.clj should be executed.*exit-fn*
- Function that is called on exit with:exit
code and:message
, an exceptional message when exit is non-zero.*getenv-fn*
- Get ENV'ironment variable, typically used for gettingCLJ_CONFIG
, etc.-main
- Seehelp-text
.clojure-tools-download-direct!
- Downloads from:url
to:dest
file returning true on success.clojure-tools-download-java!
- Downloads:url
zip file to:dest
by invokingjava
with:proxy
options on a.java
program file, and returns true on success.clojure-tools-install!
- Installs clojure tools archive by downloading it in:out-dir
, if not already there, and extracting in-place.deps-clj-version
- The current version of deps.clj.get-basis-file
- Returns path to basis file.get-cache-dir
- Returns cache dir (.cpcache
) from either local dir, ifdeps-edn
exists, or the user cache dir.get-checksum
- Returns checksum based on cli-opts (as returned byparse-cli-opts
) and config-paths (as returned byget-config-paths
).get-config-dir
- Retrieves configuration directory.get-config-paths
- Returns vec of configuration paths, i.e.get-help
- Returns help text as string.get-install-dir
- Retrieves the install directory where tools jar is located (after download).get-local-deps-edn
- Returns the path of thedeps.edn
file (as string) in the current directory or as set by-Sdeps-file
.get-proxy-info
- Returns a map with proxy information parsed from env vars.parse-cli-opts
- Parses the command line options.print-help
- Print help text.proxy-jvm-opts
- Returns a vector containing the JVM system property arguments to be passed to a new process to set its proxy system properties.set-proxy-system-props!
- Sets the proxy system properties in the current JVM.
Port of https://github.com/clojure/brew-install/blob/1.11.1/src/main/resources/clojure/install/clojure in Clojure
(*aux-process-fn* {:keys [cmd out]})
Invokes java
with arguments to calculate classpath, etc. May be
replaced by rebinding this dynamic var.
Called with a map of:
:cmd
: a vector of strings:out
: if set to:string
,:out
key in result must contains stdout
Returns a map of:
:exit
, the exit code of the process:out
, the string of stdout, if the input:out
was set to:string
(*clojure-process-fn* {:keys [cmd]})
Invokes java
with arguments to clojure.main
to start Clojure. May
be replaced by rebinding this dynamic var.
Called with a map of:
:cmd
: a vector of strings
Must return a map of :exit
, the exit code of the process.
Can be dynamically rebound to customise the download of the Clojure tools. Should be bound to a function accepting a map with:
:url
: The URL to download, as a string:dest
: The path to the file to download it to, as a string:proxy-opts
: a map as returned byget-proxy-info
:clj-jvm-opts
: a vector of JVM opts (as passed on the command line).
Should return true
if the download was successful, or false if not.
Directory in which deps.clj should be executed.
(*exit-fn* {:keys [exit message]})
Function that is called on exit with :exit
code and :message
, an exceptional message when exit is non-zero
(*getenv-fn* env)
Get ENV'ironment variable, typically used for getting CLJ_CONFIG
, etc.
(-main & command-line-args)
See help-text
.
In addition
-
the values of the
CLJ_JVM_OPTS
andJAVA_OPTIONS
environment variables are passed to the java subprocess as command line options when downloading dependencies and running any other commands respectively. -
if the clojure tools jar cannot be located and the clojure tools archive is not found, an attempt is made to download the archive from the official site and extract its contents locally. The archive is downloaded from this process directly, unless the
CLJ_JVM_OPTS
env variable is set and a succesful attempt is made to download the archive by invoking a java subprocess passing the env variable value as command line options.
(clojure-tools-download-direct! {:keys [url dest]})
Downloads from :url
to :dest
file returning true on success.
(clojure-tools-download-java! {:keys [url dest proxy-opts clj-jvm-opts]})
Downloads :url
zip file to :dest
by invoking java
with
:proxy
options on a .java
program file, and returns true on
success. Requires Java 11+ (JEP 330).
(clojure-tools-install! {:keys [out-dir debug proxy-opts clj-jvm-opts]})
Installs clojure tools archive by downloading it in :out-dir
, if not already there,
and extracting in-place.
If *clojure-tools-download-fn*
is set, it will be called for
download the tools archive. This function should return a truthy
value to indicate a successful download.
The download is attempted directly from this process, unless
:clj-jvm-opts
is set, in which case a java subprocess
is created to download the archive passing in its value as command
line options.
It calls *exit-fn*
if it cannot download the archive, with
instructions how to manually download it.
The current version of deps.clj
(get-basis-file {:keys [cache-dir checksum]})
Returns path to basis file. Required options:
-
cache-dir
as returned byget-cache-dir
-
checksum
as returned byget-check-sum
(get-cache-dir {:keys [deps-edn config-dir]})
Returns cache dir (.cpcache
) from either local dir, if deps-edn
exists, or the user cache dir.
(get-checksum {:keys [cli-opts config-paths]})
Returns checksum based on cli-opts (as returned by parse-cli-opts
)
and config-paths (as returned by get-config-paths
)
(get-config-dir)
Retrieves configuration directory.
First tries CLJ_CONFIG
env var, then $XDG_CONFIG_HOME/clojure
, then ~/.clojure.
(get-config-paths {:keys [cli-opts deps-edn config-dir install-dir]})
Returns vec of configuration paths, i.e. deps.edn from:
:install-dir
as obtained thrhoughget-install-dir
:config-dir
as obtained throughget-config-dir
:deps-edn
as obtained throughget-local-deps-edn
(get-help)
Returns help text as string.
(get-install-dir)
Retrieves the install directory where tools jar is located (after download). Defaults to ~/.deps.clj//ClojureTools.
(get-local-deps-edn {:keys [cli-opts]})
Returns the path of the deps.edn
file (as string) in the current directory or as set by -Sdeps-file
.
Required options:
:cli-opts
: command line options as parsed byparse-opts
(get-proxy-info)
Returns a map with proxy information parsed from env vars. The map will contain :http-proxy and :https-proxy entries if the relevant env vars are set and parsed correctly. The value for each is a map with :host and :port entries.
(parse-cli-opts args)
Parses the command line options.
(print-help)
Print help text
(proxy-jvm-opts {:keys [http-proxy https-proxy]})
Returns a vector containing the JVM system property arguments to be passed to a new process
to set its proxy system properties.
proxy-info parameter is as returned from get-proxy-info.
(set-proxy-system-props! {:keys [http-proxy https-proxy]})
Sets the proxy system properties in the current JVM.
proxy-info parameter is as returned from get-proxy-info.