virgil icon indicating copy to clipboard operation
virgil copied to clipboard

`lein with-profile` with lein-virgil 0.1.7 causes errors about unbound vars

Open miikka opened this issue 7 years ago • 2 comments

Hi Zach,

We have a problem when using Virgil 0.1.7 with lein with-profile. In jsonista, when we do lein with-profile dev test, we get a bunch of errors that look like this:


recompiling all files in ["/Users/miikka/code/jsonista/src/java"]
:reloading (jsonista.core jsonista.test-utils jsonista.json-perf-test jsonista.core-test)

ERROR in () (Var.java:43)
expected: (= {"hello" "world"} (-> data jsonista/write-value-as-string jsonista/read-value))
  actual: java.lang.IllegalStateException: Attempting to call unbound fn: #'jsonista.core/write-value-as-string
 at clojure.lang.Var$Unbound.throwArity (Var.java:43)
    clojure.lang.AFn.invoke (AFn.java:32)
    jsonista.core_test$eval1863$fn__1864.invoke (core_test.clj:31)
    jsonista.core_test$eval1863.invokeStatic (core_test.clj:31)
    jsonista.core_test$eval1863.invoke (core_test.clj:30)
    ...

This works just fine with Virgil 0.1.6. I looked at the code changes since then, but nothing jumped out as especially suspicious. lein with-profile default test does seem to work.

To reproduce with jsonista
git clone https://github.com/metosin/jsonista.git
cd jsonista
git checkout 73e6d4d75c0a9469ee1cba78eaa78afe3f0cd516
lein with-profile dev test

miikka avatar Nov 20 '17 09:11 miikka

This is probably a race condition, there was some threading added to debounce in situations where entire directories are changed via git. In the meantime, you should be fine targeting 0.1.6, the only changes were the aforementioned one and some fixes for Windows compatibility.

On Mon, Nov 20, 2017 at 1:06 AM Miikka Koskinen [email protected] wrote:

Hi Zach,

We have a problem when using Virgil 0.1.7 with lein with-profile. In jsonista https://github.com/metosin/jsonista, when we do lein with-profile dev test, we get a bunch of errors that look like this:

recompiling all files in ["/Users/miikka/code/jsonista/src/java"] :reloading (jsonista.core jsonista.test-utils jsonista.json-perf-test jsonista.core-test)

ERROR in () (Var.java:43) expected: (= {"hello" "world"} (-> data jsonista/write-value-as-string jsonista/read-value)) actual: java.lang.IllegalStateException: Attempting to call unbound fn: #'jsonista.core/write-value-as-string at clojure.lang.Var$Unbound.throwArity (Var.java:43) clojure.lang.AFn.invoke (AFn.java:32) jsonista.core_test$eval1863$fn__1864.invoke (core_test.clj:31) jsonista.core_test$eval1863.invokeStatic (core_test.clj:31) jsonista.core_test$eval1863.invoke (core_test.clj:30) ...

This works just fine with Virgil 0.1.6. I looked at the code changes since then, but nothing jumped out as especially suspicious. lein with-profile default test does seem to work. To reproduce with jsonista

git clone https://github.com/metosin/jsonista.git cd jsonista git checkout 73e6d4d75c0a9469ee1cba78eaa78afe3f0cd516 lein with-profile dev test

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ztellman/virgil/issues/15, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB6P8hcw9cOpJbEzjuc6LUZ7wQSqvVkks5s4UD_gaJpZM4Qj748 .

ztellman avatar Nov 20 '17 21:11 ztellman

virgil/watch didn't wait for the first recompile to finish and instead scheduled a thread to do the compilation. The error has been introduced in dc9d4acd7bfa28b7da73a828339f0 (sorry my fault).

The above PR seems to fix the issue.

schmir avatar Nov 20 '17 22:11 schmir

Closing since virgil no longer offers a Leiningen plugin. Feel free to reopen if this also happens with watch-and-recompile.

alexander-yakushev avatar Jul 23 '24 13:07 alexander-yakushev