bhauman / figwheel-main

Figwheel Main provides tooling for developing ClojureScript applications
https://figwheel.org
Eclipse Public License 1.0
640 stars 93 forks source link

Treat descendants of classpath dir as classpath #276

Open werenall opened 3 years ago

werenall commented 3 years ago

Hello! Here in Magnet we noticed that figwheel complained about a path not being on classpath despite the that that it was held in resources/ that were added to resources path. Then we found the issue #221 that we believe is the same thing. We came up with this solution where we not only check for exact match in classpath but for any known classpath that is a (0, x) substring of the canonical path in question.

[Re #221]

bhauman commented 3 years ago

Sorry for not getting back sooner. I would need the specific complaint and situation. If its complaining about the target directory not being on the classpath. Then this solution won't work if you are using Figwheels server to serve your application. If you are using your own server then I would set :helpful-classpaths false so that these warnings will go away.

bhauman commented 3 years ago

You can use :helpful-classpaths false in your figwheel config to turn these helpers off.

iarenaza commented 3 years ago

Hi @bhauman

thanks for looking into this. Unfortunately setting :helpful-classpaths to false turns the helpers off, but the warnings don't go away as you said.

Looking at https://github.com/bhauman/figwheel-main/blob/v0.213/src/figwheel/main.cljc#L2014-L2032 you can see that if the target directory is considered to be outside of the classpath and doesn't exist, then we get a warning whether :helpful-classpaths is true of false (a different warning in each case, but a warning nonetheless).

And looking at https://github.com/bhauman/figwheel-main/blob/v0.213/src/figwheel/main.cljc#L2035-L2046 something similar happens: either we get the warning from warn-that-dir-not-on-classpath if :helpful-classpaths is true, or we get the warning from lines 2041 to 2046.

timothypratley commented 2 years ago

@iarenaza where would you like to go with this PR? It seems to me that the correct change is to suppress the warning when the flag is set to false? If so would you mind updating the PR to reflect this?