Skip to content

Commit 59c377f

Browse files
Benedek FazekasBenedek Fazekas
authored andcommitted
[Fix #97] Use fake.class.path in case the project is managed by boot
Intend to work around problems discussed in boot-clj/boot#251 and boot-clj/boot#249. Because of `boot`-s inner workings the original directories for the project source paths are on `fake.class.path` and the real classpath points to a temporary directory for the source files. This confuses cljr. See corresponding fix for cider: clojure-emacs/cider-nrepl#422
1 parent d56b676 commit 59c377f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/refactor_nrepl/core.clj

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,22 @@
4141
false
4242
(:ignore-paths config/*config*))))
4343

44+
(defn boot-project? []
45+
;; fake.class.path under boot contains the original directories with source
46+
;; files, see https://github.com/boot-clj/boot/issues/249
47+
(not (nil? (System/getProperty "fake.class.path"))))
48+
4449
(defn dirs-on-classpath
4550
"Return all dirs on classpath, filtering out our inlined deps
46-
directory and paths matching :ignore-paths specified in config."
51+
directory and paths matching :ignore-paths specified in config.
52+
For boot it considers `fake.class.path` rather than real classpath."
4753
[]
48-
(->> (cp/classpath)
49-
(filter fs/directory?)
50-
(remove #(-> % str normalize-to-unix-path ignore-dir-on-classpath?))))
54+
(let [files-on-cp (if (boot-project?)
55+
(map io/file (str/split (System/getProperty "fake.class.path") #":"))
56+
(cp/classpath))]
57+
(->> files-on-cp
58+
(filter fs/directory?)
59+
(remove #(-> % str normalize-to-unix-path ignore-dir-on-classpath?)))))
5160

5261
(defn project-root
5362
"Return the project root directory.

0 commit comments

Comments
 (0)