-
Notifications
You must be signed in to change notification settings - Fork 10
Support Babashka #25
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
Support Babashka #25
Conversation
| "namespace '%s' not found after loading '%s'" | ||
| ns (.getPath file)) | ||
| (when (not (find-ns ns)) | ||
| (throw (Exception. (format "namespace '%s' not found after loading '%s'" ns (.getPath 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.
Babashka doesn't have this private fn.
Not the same exception, but it didn't seem significant for this to be a compiler exception with line and column.
test/clj_reload/keep_test.clj
Outdated
|
|
||
| (defn meta= [a b] | ||
| (= (dissoc (meta a) :ns) (dissoc (meta b) :ns))) | ||
| (= (dissoc (meta a) :ns :file) (dissoc (meta b) :ns :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.
In bb :file goes from absolute to relative here:
(-> a meta :file) /Users/filipesilva/repos/sandbox/clj-reload/fixtures/keep_test/clj_reload/keep_vars.clj
(-> b meta :file) clj_reload/keep_vars.clj
Didn't seem important to check. I think this test just cares about the user metadata being retained.
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.
Actually I would like to keep the check here. Happy to skip it for bb? only and leave it for Clojure
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.
Sure thing, done and pushed 👍
f160981 to
a03e8aa
Compare
test/clj_reload/keep_test.clj
Outdated
| (is (not (identical? keep-new @(ns-resolve ns' 'type-keep-new)))) | ||
| (is (= keep-new @(ns-resolve ns' 'type-keep-new))) | ||
| (is (identical? (class keep-new) (class @(ns-resolve ns' 'type-keep-new)))) | ||
| (when-not (tu/babashka?) |
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.
Compare with github's "Hide whitespace". I'm just not running these 4 tests when on bb.
a03e8aa to
ad59464
Compare
|
Related babashka/babashka#1839 |
|
I had done some work on this too here: borkdude@40305ce Feel free to borrow from that if you want too. |
Should be working, with the notable exceptions of `:clj-reload/keep` metadata in deftype/defrecord/defprotocol. I traced it down to how `clj-reload.keep/patch-file` will create an import like `(clojure.core/import clj_reload.keep_deftype.TypeKeep)` in `keep-type-test`, but in Babashka that's not available anymore after `clj-reload.core/ns-unload` calls `(remove-ns ns)`. So in bb we get `java.lang.Exception: Unable to resolve classname: clj_reload.keep_deftype.TypeKeep`. I'm guessing Clojure's `remove-ns` doesn't remove the Java types but in Babashka it does.
ad59464 to
407a733
Compare
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.
All good with 1 note
test/clj_reload/keep_test.clj
Outdated
|
|
||
| (defn meta= [a b] | ||
| (= (dissoc (meta a) :ns) (dissoc (meta b) :ns))) | ||
| (= (dissoc (meta a) :ns :file) (dissoc (meta b) :ns :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.
Actually I would like to keep the check here. Happy to skip it for bb? only and leave it for Clojure
|
Thanks! Merged |
Should be working, with the notable exceptions of
:clj-reload/keepmetadata in deftype/defrecord/defprotocol.I traced it down to how
clj-reload.keep/patch-filewill create an import like(clojure.core/import clj_reload.keep_deftype.TypeKeep)inkeep-type-test, but in Babashka that's not available anymore afterclj-reload.core/ns-unloadcalls(remove-ns ns). So in bb we getjava.lang.Exception: Unable to resolve classname: clj_reload.keep_deftype.TypeKeep.I'm guessing Clojure's
remove-nsdoesn't remove the Java types but in Babashka it does.cc @borkdude