Fork me on GitHub
#tools-deps
<
2021-12-23
>
Alex Miller (Clojure team)00:12:19

can you explain what that means?

Alex Miller (Clojure team)00:12:00

just collecting all the transitive jars without rebundling them?

Alex Miller (Clojure team)00:12:39

if you use create-basis, it has paths to all the libs in it, you could combine that with copy-file

hiredman00:12:45

https://gist.github.com/hiredman/d68cafb6aa8cea563c7b77d54f522421 does something like that. Uses sftp to copy jars and dirs (git deps) to a remote system and generates a premade classpath file, but it was never fully developed and is based on an older tools.deps

hiredman00:12:55

Oh, and it hashes everything and skips copy anything that already exists

Alex Miller (Clojure team)00:12:20

(let [target "target/libs"]
    (doseq [[lib coord] (-> (b/create-basis nil) :libs)]
      (doseq [path (:paths coord)]
        (b/copy-file {:src path
                      :target (str target "/" (.getName (jio/file path)))}))))
something like that

Alex Miller (Clojure team)00:12:57

if you care about local/git libs, you'd want to be a little more careful what you copy out of :paths

markaddleman15:12:14

I'm using https://github.com/seancorfield/build-clj (thanks, @seancorfield!) to create an AOT uberjar. I'm using clojure 1.11.0-alpha3. When I compile the uber jar, I get a couple of reflection warnings and several warnings like WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-keys. I'm not concerned about any of these warnings. When I run my application using java -jar uber.jar , I get the same set of warnings as the application starts up. This surprises me. I expect the warnings during AOT compilation but I do not expect them when running as a set of AOT classes. Maybe my understanding of how executing an AOT jar is wrong. Is this behavior expected?

borkdude15:12:25

@markaddleman I think there is a new version of tools.analyzer which solves these warnings. they are caused by same-named vars in clojure.core in clojure 1.11

borkdude15:12:46

they should not affect the behavior of your program though

markaddleman15:12:13

Thanks. I think analyzer is getting pulled in transitively (probably through core.async but I haven't investigated)

markaddleman15:12:11

But, that's not really my worry. I'm wondering why I'm getting these warnings when executing an AOT jar. I expected that these warnings occur when loading the namespace for compilation but the resulting bytecode would not re-evaluate.

borkdude15:12:07

vars in clojure are still dynamically created at load time, even when source has already been AOT-ed

markaddleman15:12:48

Oh, duh, of course. The warnings are not about the namespace loading per se, they are about creating the vars. Thanks!

Alex Miller (Clojure team)15:12:12

that is all correct, and most recent core.async / tools.analyzer.jvm will fix the warnings

🙏 1
Alex Miller (Clojure team)19:12:54

(note: version above was supposed to be 1.10.3.1053)