Fork me on GitHub
#figwheel-main
<
2018-07-13
>
dnolen00:07:48

@bhauman I’m not sure how figwheel-main detects what is or isn’t on the classpath but it doesn’t really seem to work

dnolen00:07:08

I have aliases that provide :extra-paths and Figwheel doesn’t seem to know this

dnolen00:07:17

and complains about stuff that most definitely is on the classpath

dnolen00:07:16

@bhauman actually ignore what I said - it was working 😛

dnolen00:07:47

I was confused because I missed that Figwheel attempts to fix it

dnolen02:07:28

ah so I know what my issue actually is - @bhauman I don’t necessarily want src on the classpath

dnolen02:07:36

adding something I don’t want is actually problematic

dnolen02:07:06

i.e. src/cljs structure

pesterhazy08:07:13

Would it help in your case if figwheel compiled files lazily instead of eagerly processing all the cljs files on the classpath?

bhauman12:07:53

@dnolen yeah an option is needed to disable that behavior

bhauman12:07:15

but I normally only add "src" if your :main is in the "src" directory it would be helpful to know your specific case and which warning is getting printed

dnolen14:07:45

@bhauman my :main is in source but it’s not rooted at src

dnolen14:07:53

it rooted at src/cljs

dnolen14:07:00

so mucking with the classpath that I want is not desirable

dogenpunk14:07:02

Anyone running into this exception when trying to startup figwheel?

conductor.core> (require 'figwheel.main)
CompilerException java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V, compiling:(figwheel/main.cljc:1:1) 

dogenpunk15:07:17

In the event someone else runs into this, it’s caused by a transitive dependency in the autoclave library on an older version of guava. Adding

:exclude [com.google.guava/guava]
to the dependency resolved this issue.

bhauman14:07:12

@dnolen gotcha, will make an option, but its good to know that there is also a bug in my code because it should have added "src/cljs"

dnolen14:07:38

sorry not being clear

dnolen14:07:44

src/cljs does get added

dnolen14:07:03

the problem is if I set :path and I don’t include "src" intentionally

dnolen14:07:07

Figwheel messes up my classpath

bhauman14:07:13

So definitely going to make a switch

bhauman14:07:53

so you are adding a :main that is in cljs/src but you don't want it on your classpath

bhauman14:07:21

I can understand that

dnolen14:07:25

I would argue for not making a switch - but only fixing it if you can determine it was a actually mistake

dnolen14:07:34

let me show you something minimal so you can see what I mean

bhauman14:07:18

meanwhile I'm spending the day figuring out how to get a multi-domain HTTPs support running in an a letsencrypt world

dnolen15:07:12

@bhauman hrm, ignore what I’ve said for now - I can’t make it minimal - will hunt it down and put something together later

bhauman15:07:43

please when you get a chance, I'd love to understand

dnolen15:07:17

yes definitely will

dnolen19:07:17

@bhauman hrm I’m seeing some bizarre behavior - when I run figwheel it generates a target directory?

bhauman19:07:01

yes that happens

dnolen19:07:20

I also see that it added target to the classpath

dnolen19:07:27

which I most definitely do not want

bhauman19:07:03

yeah that's part of the same behavior that I'll be making the flag for

bhauman19:07:30

if you don't have an output directory on the classpath figwheel can't server your assets

bhauman19:07:40

you can't add a classpath for a path that doesn't exist

bhauman19:07:10

and have it take affect for resources

dnolen19:07:11

:output-dir is specified in all cases

dnolen20:07:40

and "resources" is on every classpath

dnolen20:07:51

and :output-dir is always "resources/public/..."

bhauman20:07:13

and it's not though

bhauman20:07:44

the default :output-dir is "target/public"

dnolen20:07:56

what I mean is in my project

dnolen20:07:05

not somebody else’s project

dnolen20:07:10

so I don’t understand why I’m getting target

bhauman20:07:20

yes I get your meaning

bhauman20:07:48

you have and output-dir defined and there is no need to add one in that case

bhauman20:07:57

makes absolute sense

dnolen20:07:33

the end result for me is everything is getting completely messed up

dnolen20:07:47

and Figwheel is more or less ruining how tools deps is supposed to be used

dnolen20:07:05

tools-deps let’s me control the classpath finally

dnolen20:07:12

but Figwheel does all this stuff I do not want

bhauman20:07:47

its 3 different things, and they are there to help folks when they start out

dnolen20:07:00

I understand that

dnolen20:07:04

but it breaks tools-deps

dnolen20:07:10

I can no longer control the classpath

dnolen20:07:16

and I have push everything around

dnolen20:07:25

and files are compiling which shouldn’t etc. etc. etc.

bhauman20:07:35

yes this is not what I want

bhauman20:07:52

you are perhaps the first power user

bhauman20:07:06

and as that person you are helping me

dnolen20:07:29

sure but it’s also breaking a simple tutorial

dnolen20:07:35

where I want people to be able to run

dnolen20:07:51

clj -A:tut1 -m figwheel.main -b builds/tut1 -r

dnolen20:07:04

and then can just cycle through tutorials in one project

bhauman20:07:34

and that should be possible

dnolen20:07:39

so their understanding of tools deps will be completely obfuscated

bhauman20:07:59

so why not use the defaults?

bhauman20:07:28

I'm happy to address these issues

dnolen20:07:31

ok - sure I have to refactor this into N different folders

dnolen20:07:44

and skip trying to explain how tools-deps solve very typical problems

bhauman20:07:46

you shouldn't have to?

dnolen20:07:50

w/o hoop-jumping

dnolen20:07:54

I don’t see how?

dnolen20:07:02

I can’t control the classpath

dnolen20:07:08

and can’t control what goes into the build

bhauman20:07:19

I understand completely now

bhauman20:07:43

source files with the same names changing incrementally

bhauman20:07:00

I'm working on this problem now if you want to wait a beat.

dnolen20:07:47

thanks, working on some slides now - let me know if it’s too much fiddling, I can split the directory structure if so

dnolen20:07:10

I did this way mostly so I could share the resources directory when serving (i.e. index.html / CSS) which aren’t changing

john20:07:21

Is it possible to provide a default and override it if someone provides a :target-dir? I'm liking figwheel.main's out-of-the-box experience and defaults.

john20:07:46

keeping artifacts out of "resources" makes cleanup simpler too

bhauman20:07:18

@john not sure I understand, I'm keeping the behavior and making a switch turn the helpfulness off

john20:07:59

ah k, that's what I was wondering about

bhauman20:07:37

and @dnolen hmm it was using the :output-to to derive the target directory, changing it to :output-dir

bhauman20:07:17

not sure why it was generating an "target" directory

bhauman20:07:39

but almost done with the flag

dnolen21:07:36

k thanks again

bhauman21:07:22

also the code that was creating the source directory was naive in that it was creating the directory for the first source file with the :main ns it found. It should have checked the classpath first.

bhauman21:07:23

nah that was wrong it is checking the classpath first for the namespace and if it can't find it adds the classpath

dnolen21:07:40

yeah, that’s what I observed

dnolen21:07:46

and you’re treating src as a special case?

dnolen21:07:51

that’s what I can’t sort out

dnolen21:07:00

k give me one second

bhauman21:07:04

not treating it as a special case

dnolen21:07:56

just made this public

dnolen21:07:13

try clj -A:tut1 -m figwheel.main -b builds/tut1 -r

dnolen21:07:19

to see what I’m seeing

dnolen21:07:29

I could also very well be doing something stuipd

bhauman21:07:32

man you should have pointed me to this earlier

dnolen21:07:47

it wasn’t public, and I had remove a bunch of other problems first

bhauman21:07:19

cool, make the watch-path equivalent to the classpath

bhauman21:07:25

for each tutorial

bhauman21:07:38

that's the special case

dnolen21:07:38

is that why src gets added?

dnolen21:07:50

ah k so that was counterintuitive

bhauman21:07:55

watch-paths = source-paths

dnolen21:07:11

so is that part of the metadata?

bhauman21:07:29

yeah you have it in each build file

bhauman21:07:39

:watch-paths

dnolen21:07:48

:watch-dirs

dnolen21:07:50

so this was my fault

bhauman21:07:53

sorry 🙂

bhauman21:07:57

watch-dirs

bhauman21:07:41

watch-dirs is equivalent to -w flag

bhauman21:07:05

which is also treated a source directory to pass to the compiler

bhauman21:07:25

so that's what was throwing you

dnolen21:07:37

so :watch-dirs must be explicitly supplied right?

dnolen21:07:45

yeah the classpath stuff was really a red-herring

bhauman21:07:45

actually it could be autodetected if your main is on your classpath

bhauman21:07:01

but its better to supply it explicitly

dnolen21:07:09

sanity regained

dnolen21:07:13

sorry for the runaround

bhauman21:07:10

no worries, it was helpful

bhauman21:07:18

@dnolen so no problem with the target directory?

bhauman21:07:58

or was that an outcome of trying different things to make it work

dnolen21:07:02

no it was exactly what you said, a missing build config

bhauman22:07:33

also I'm always surprised that build files in directories work, as I never explicitly intended that