From e0217fde8455ebdaa1f2231aef21f94264a1c40b Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sun, 7 Jan 2024 16:56:49 -0600 Subject: [PATCH] Fix bug in TDEPS-256 change for :project usin relative dirs --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/deps.clj | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f10d31d..d1eca45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ Changelog *Also see [Tools and installer changelog](https://github.com/clojure/brew-install/blob/1.11.1/CHANGELOG.md)* +* next + * Fix bug in TDEPS-256 change for :project usin relative dirs * 0.18.1398 on Jan 4, 2023 * Fix function spec typo * 0.18.1394 on Dec 29, 2023 diff --git a/src/main/clojure/clojure/tools/deps.clj b/src/main/clojure/clojure/tools/deps.clj index b4d490e..35f6eb5 100644 --- a/src/main/clojure/clojure/tools/deps.clj +++ b/src/main/clojure/clojure/tools/deps.clj @@ -790,13 +790,15 @@ (defmacro ^:private in-project-dir "If project deps.edn is not in the current dir, push project directory into current directory context while creating basis. Local deps use paths - relative to project dir." + relative to project dir. Use anaphoric 'assumed-project in body." [project-deps & body] `(if (and (instance? String ~project-deps) (not (.equals dir/*the-dir* (.getParentFile (jio/file ~project-deps))))) (dir/with-dir (.getParentFile (jio/file ~project-deps)) - ~@body) - (do ~@body))) + (let [~'assumed-project (.getName (jio/file ~project-deps))] + ~@body)) + (let [~'assumed-project ~project-deps] + ~@body))) (defn create-basis "Create a basis from a set of deps sources and a set of aliases. By default, use @@ -834,7 +836,10 @@ :classpath-roots - vector of paths in classpath order" [{:keys [root user project extra aliases] :as params}] (in-project-dir project - (let [basis-config (cond-> nil + (let [project assumed-project ;; use anaphoric for project deps in context of project dir + params (cond-> params (contains? params :project) (assoc :project project)) + + basis-config (cond-> nil (contains? params :root) (assoc :root root) (contains? params :project) (assoc :project project) (contains? params :user) (assoc :user user)