-
Notifications
You must be signed in to change notification settings - Fork 69
Fix the build / honor the refresh-dirs
#298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(ns global-test-setup | ||
"This namespace's contents will be automatically loaded by `lein test` (or any test runner)." | ||
(:require | ||
[refactor-nrepl.inlined-deps.toolsnamespace.v1v1v0.clojure.tools.namespace.repl :refer [set-refresh-dirs]])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this would be:
- refactor-nrepl.inlined-deps.toolsnamespace.v1v1v0.clojure.tools.namespace.repl
+ clojure.tools.namespace.repl
but I couldn't wait get it to work. It looked like mranderson :expositions would do the trick but nope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this old issue to me benedekfazekas/mranderson#5
@@ -37,8 +55,28 @@ | |||
:when ((set deps) ns)] | |||
file))) | |||
|
|||
(defn- in-refresh-dirs? [refresh-dirs file] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can add a unit test to this one. For now I didn't b/c my reasoning was that this is a private helper, and often private helpers are left untested.
Don't know how clojure-emacs
folks tend to approach these - would be happy to tweak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't typically add tests for private helpers.
Fixes the build with the following strategy: * isolate the "Lein plugin" part to its own source path * this makes it possible to exercise older versions of Clojure, which don't have e.g. `*print-namespace-map*`, which the Lein implementation can assume. * When tools.namespace `refresh-dirs` are set, don't analyze files outside those refresh dirs. * This is a quality of life improvement anyway. A properly set up Clojure project (that is using tools.namespace) tends to have the `refresh-dirs` set. * This way end users don't have extraneous code possibly analyzed code: examples, drafts, production scripts, etc all of which is dangerous to analyze (because analysis == execution). * For this to work, tools.namespace is resolved in runtime. * `cider-refresh` does the same: https://git.io/JOYUT
The changes look good to me. Thanks! |
Fixes the build with the following strategy:
*print-namespace-map*
, which the Lein implementation can assume.refresh-dirs
are set, don't analyze files outside those refresh dirs.refresh-dirs
set.cider-refresh
does the same: https://git.io/JOYUTlein do clean, test
)./build.sh install
-- takes a long time)