Skip to content

Commit

Permalink
Fix #106: System deps.edn should be extracted on tools install (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude authored Jul 7, 2023
1 parent 9124574 commit bd6b36e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ DEPS_CLJ_TOOLS_VERSION=1.11.1.1165 bb clojure
## Unreleased

- [#104](https://github.com/borkdude/deps.clj/issues/104): print repl-aliases in -Sdescribe
- Make installation of tools jar more robust using transaction file
- #106: System deps.edn should be extracted on tools install

## 1.11.1.1347

Expand Down
19 changes: 16 additions & 3 deletions src/borkdude/deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ public class ClojureToolsDownloader {
It calls `*exit-fn*` if it cannot download the archive, with
instructions how to manually download it."
[{:keys [out-dir debug proxy-opts clj-jvm-opts]}]
[{:keys [out-dir debug proxy-opts clj-jvm-opts config-dir]}]
(let [{:keys [ct-error-exit-code ct-url-str ct-zip-name]} @clojure-tools-info*
dir (io/file out-dir)
zip-file (io/file out-dir ct-zip-name)
Expand All @@ -552,6 +552,19 @@ public class ClojureToolsDownloader {
(warn "Unzipping" (str zip-file) "...")
(unzip zip-file (.getPath dir))
(.delete zip-file)
(when config-dir
(let [config-deps-edn (io/file config-dir "deps.edn")
example-deps-edn (io/file out-dir "example-deps.edn")]
(when (and (not (.exists config-deps-edn))
(.exists example-deps-edn))
(io/make-parents config-deps-edn)
(io/copy example-deps-edn config-deps-edn)))
(let [config-tools-edn (io/file config-dir "tools" "tools.edn")
install-tools-edn (io/file out-dir "tools.edn")]
(when (and (not (.exists config-tools-edn))
(.exists install-tools-edn))
(io/make-parents config-tools-edn)
(io/copy install-tools-edn config-tools-edn))))
;; Successful transaction
(.delete transaction-start))
(warn "Successfully installed clojure tools!"))
Expand Down Expand Up @@ -842,6 +855,7 @@ public class ClojureToolsDownloader {
proxy-opts (get-proxy-info)
proxy-settings (proxy-jvm-opts proxy-opts)
clj-jvm-opts (some-> (*getenv-fn* "CLJ_JVM_OPTS") (str/split #" "))
config-dir (get-config-dir)
tools-cp
(or
(when (and (.exists tools-jar)
Expand All @@ -850,7 +864,7 @@ public class ClojureToolsDownloader {
(.getPath tools-jar))
(binding [*out* *err*]
(warn "Clojure tools not yet in expected location:" (str tools-jar))
(clojure-tools-install! {:out-dir libexec-dir :debug debug :clj-jvm-opts clj-jvm-opts :proxy-opts proxy-opts})
(clojure-tools-install! {:out-dir libexec-dir :debug debug :clj-jvm-opts clj-jvm-opts :proxy-opts proxy-opts :config-dir config-dir})
tools-jar))
mode (:mode cli-opts)
exec? (= :exec mode)
Expand All @@ -863,7 +877,6 @@ public class ClojureToolsDownloader {
clj-jvm-opts
proxy-settings
["-classpath" tools-cp "clojure.main"]))
config-dir (get-config-dir)
java-opts (some-> (*getenv-fn* "JAVA_OPTS") (str/split #" "))]
;; If user config directory does not exist, create it
(let [config-dir (io/file config-dir)]
Expand Down

0 comments on commit bd6b36e

Please sign in to comment.