Fork me on GitHub
#tools-deps
<
2022-07-27
>
seancorfield20:07:16

@alexmiller "This branch is 8 commits ahead, 117 commits behind master." -- can we get t.d.a master merged to add-lib3, or is there some impediment to that now?

seancorfield20:07:33

I just did a test merge locally and there are no conflicts, but I didn't attempt to run any tests etc.

ag21:07:33

While trying clj -T:build jar, I'm getting weird error I haven't seen before.

Execution error (ClassNotFoundException) at jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:641).\norg.objectweb.asm.Type\n
Anyone familiar? Any pointers are appreciated.

seancorfield21:07:10

Sounds like a version conflict somewhere in the dependencies. What is your :build alias and what is the jar task in build.clj? Also, do you have more of a stacktrace?

ag21:07:10

> What is your :build alias

:build
  {:extra-paths ["src"]
   :extra-deps {io.github.clojure/tools.build
                {:git/tag "v0.8.3" :git/sha "0d20256"}}
   :ns-default build}
> Do you have more of a stacktrace? It's a bit overloaded, but I couldn't decipher it. Let me dig a bit more, maybe I could still figure it out on my own.

ag21:07:23

jar task:

(defn jar [_]
  (b/write-pom {:class-dir class-dir
                :lib lib
                :version nil
                :basis basis
                :src-dirs ["src"]})
  (build-cljs+css nil) ;; this can be ignored (the problem is not here)
  (b/copy-dir {:src-dirs ["src" "resources"]
               :target-dir class-dir})
  (println "BUILD: Producing jar:" jar-file "...")
  (b/compile-clj {:basis basis
                  :src-dirs ["src"]
                  :class-dir class-dir})
  (b/uber {:class-dir class-dir
           :uber-file jar-file
           :basis basis
           :manifest {"Main-Class" "iroh_front_end.server.system"}})
  (println "BUID: Done building jar."))

seancorfield21:07:44

So it's coming from compilation of some core.async stuff that is referenced from iroh_front_end.shadow_cljs_helpers whatever that is...?

hiredman21:07:21

you have some bogus dependency information somehow, core.async uses tools.analyzer.jvm, which has a dependency on the library where rg.objectweb.asm.Type comes from

hiredman21:07:47

so if org.objectweb.asm.Type is missing, somehow the jvm isn't being started with asm on the classpath

seancorfield21:07:00

Yup, I was just about to ask how you compute basis and whether you are missing some aliases there?

hiredman21:07:10

it would be very surprising to get tools.analyzer.jvm on the classpath, but not org.objectweb.asm.Type with any basis

hiredman21:07:45

my guess would be some kind of uberjar as a dependency shenanigans

thheller21:07:20

it probably shouldn't even be compiling that file in the first place? I guess you use it for development stuff? I hope you are not using shadow-cljs in any production setup?

hiredman21:07:03

cljs recently (maybe months ago?) switched to a vendored version of some of the core libs because of clashes, I wonder if it is the cljs stuff in your build

ag21:07:26

Oh, so the issue it seems that I need a dependency (shadow-cljs) included, but it's in :extra-deps key in an alias. how do I include deps in an alias with clj -T? doing clj -T:shadow-cljs:buld jar, didn't work. I tried clj -A:shadow-cljs -T:build jar - still didn't work

thheller21:07:41

I strongly recommend to never run shadow-cljs as part of a tools.build task

thheller21:07:48

(since CLJS compilation needs access to all your CLJS dependencies, so you'll just end up including your whole project, which build tasks aren't designed to do I guess)

seancorfield21:07:10

It's somewhat confusing that your task is called jar but it's actually building an uber JAR 🙂

ag21:07:38

ah, right... gotta rename it. good point

seancorfield21:07:23

That's where you would specify :shadow-cljs rather than on the command-line.

ag21:07:01

Ah... I see

seancorfield21:07:35

But as Thomas says, you probably need to run a shadow build to generate JS and then copy that into your uberjar, rather than trying to run Clojure's compile-clj with all the Shadow stuff included.

seancorfield22:07:44

I would have expected that to be done via your build-cljs+css function?

thheller22:07:42

I mean if thats running a new JVM process thats fine, but if its running as part of the build task JVM thats not great

ag22:07:28

> I would have expected that to be done via your build-cljs+css function? that's what it does, but I also have shadow-cljs-helpers.clj, they need shadow-cljs dep included

thheller22:07:40

similar as to how compile-clj is launching a new JVM I guess

seancorfield22:07:44

build.clj can easily spawn separate processes to run this stuff in isolation. That's what my build-clj wrapper does for running tests, for example, and it provides for running arbitrary tasks in isolation too.

ag22:07:26

Sean, what's the format of :aliases of create-basis? Should it be string or vector?

ag22:07:37

looks like vector of keywods... I think

ag22:07:46

That did it. Thank you everyone. I think that fixed the issue. Really appreciate your help. Without you, I'd be stuck for a very long time, for sure.

1