Fork me on GitHub
#boot
<
2017-07-31
>
dimovich11:07:45

how can I use :npm-deps with .cljs.edn files?

dimovich11:07:01

adding them to :compiler-options doesn't seem to work

richiardiandrea11:07:09

@dimovich make sure to use the newest boot-cljs and if that still does not work you can open an issue, it is such a new feature that there might be some work to do there, Juho is always very responsive

juhoteperi11:07:33

I have tested :npm-deps with Boot-cljs, it works

juhoteperi11:07:12

@dimovich If you want ClojureScript to automatically install the deps, you need to add :install-deps true option also

richiardiandrea11:07:34

ah ah great talking about responsiveness 😄

dimovich11:07:13

@richiardiandrea @juhoteperi Updated boot-cljs. Works now, thanks!

dimovich11:07:00

for some modules got a "clojure.lang.ExceptionInfo: INTERNAL COMPILER ERROR."

dimovich11:07:07

but this is another issue anyway 🙂

juhoteperi11:07:41

That sounds like a case where Closure just can't process some CommonJS files

donyorm11:07:45

How can I add a jar to the classpath with boot, it's a local file, not in the maven repository (I'm trying to create a program with plugin support, and for now I need boot to add it to the classpath)

donyorm11:07:30

Does this not require the jar to already be on the classpath? The sift task docs say that (and that task's code says it behaves similiarly to sift). What does "already resolved" me in this case?

richiardiandrea11:07:59

already resolved means that you know already the path to .m2/repository

donyorm11:07:14

right, let me give it a shot

donyorm12:07:47

That didn't seem to work. I'm trying to implement this system: https://yogthos.net/posts/2015-01-15-A-Plugin-System-in-Clojure.html, but without specying the jars in the project dependencies (loading them once the app starts or through a launcher and getting all the jars in the specified directory). I don't see the added jars in the classpath, or in the program's output, even when running them through this task

richiardiandrea13:07:41

boot has boot.pod/add-dependencies if you need to add dependency from vectors

richiardiandrea13:07:52

that would add it to the main pod though, so it always depends on which classloader we are talking about 😄

donyorm14:07:39

Is using add-classpath suitable for production code? I was going to just use that at first but people advised against it.

richiardiandrea14:07:10

well production code with runtime loading of classes in general feels a bit sketchy

richiardiandrea14:07:43

but we are in Clojure so as long as you do it on start maybe it is ok

donyorm03:08:39

Yeah, it's not super-important production (a desktop application for worldbuilding, not anything life-threatening 🙂 ), so I might just try it. But would the proper way be to add the plugin jars to the classpath when starting the program?

richiardiandrea11:07:32

(good job with the Luminous port btw)

donyorm11:07:17

thanks, I'm pretty happy with it, though I imagine it still has a few rough places to be smoothed out

tmarble14:07:19

Are there any examples / best practices of how to include Java source in a boot project (i.e. I'd like to (:import [myproject.helpers MyClass]) into my CLJ source)?

richiardiandrea14:07:09

@tmarble usually as long as they are on the classpath you should be able to import them

tmarble14:07:25

@richiardiandrea do I add a javac task?

richiardiandrea14:07:31

but I guess they need to be compiled

richiardiandrea14:07:45

yeah, never tried that but it makes sense to add javac

Chris Bidler14:07:35

gen-class generates the JVM bytecode to "wrap" a Clojure namespace in real Java class so your Clojure code can participate in e.g. being the entrypoint of java -jar ./my-project-standalone.jar

Chris Bidler14:07:17

Which seems to be the opposite of what you want, which is to compile Java sources and have them available to the Clojure runtime just like any library JAR you'd pull off Maven Central

Chris Bidler14:07:31

But perhaps (even "likely") I misunderstand. :)

Chris Bidler14:07:03

The last time I worked in a mixed Java/Clojure project was before Boot's time, but it definitely involved having a Leiningen javac step to compile the Java sources and put their byte code on the project classpath

tmarble14:07:01

yep @chris_johnson I think you're correct

richiardiandrea14:07:29

no yeah gen-class does not feel the right choice here, you compile, then you load the bytecode in the classpath so that it is visible to Clojure

qqq22:07:44

In boot, when there are multiple unrelated tasks (one for client cljs, one for clj), the 'idiomatic' way is to run separate boot tasks right? This would imply different JVMs. Why do people not use one JVM with multiple threads ?