This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-18
Channels
- # announcements (2)
- # asami (20)
- # aws (4)
- # babashka (35)
- # beginners (47)
- # calva (65)
- # cider (19)
- # clj-kondo (63)
- # clojure (177)
- # clojure-austin (2)
- # clojure-europe (27)
- # clojure-nl (1)
- # clojure-uk (4)
- # clojurescript (13)
- # community-development (5)
- # conjure (5)
- # css (2)
- # data-oriented-programming (9)
- # datalevin (13)
- # datascript (15)
- # datomic (4)
- # devcards (6)
- # duct (4)
- # emacs (8)
- # funcool (1)
- # gratitude (2)
- # helix (3)
- # hyperfiddle (3)
- # introduce-yourself (1)
- # jobs (4)
- # jobs-discuss (26)
- # lambdaisland (2)
- # lsp (20)
- # malli (2)
- # meander (2)
- # mid-cities-meetup (5)
- # missionary (15)
- # music (4)
- # off-topic (37)
- # reagent (3)
- # reitit (2)
- # releases (2)
- # ring (18)
- # shadow-cljs (70)
- # specter (4)
- # sql (20)
- # timbre (3)
- # tools-build (43)
- # tools-deps (11)
- # vim (29)
- # xtdb (61)
they are at different points, but a repro would sure help
I am not sure what happens. It's a case where if I run an uberjar task (with aot) from a module it just works but from a process that iterates over modules and run it for each deployable it then fails compiling the mains (just the mains). /tmp/compile-clj1025453397036198757/compile-clj/foo/main.class and the command starts with : java -cp /tmp/compile-clj1025453397036198757/compile-clj:... anyway I ll dig further
@U050SC7SV Maybe you are skipping some binding/context when iterating over the project dirs? Here's what we do at work:
(doseq [p projects]
(println "\nRunning: uber on" p)
(let [project-dir (str "projects/" p)
aliases (with-dir (io/file project-dir) (get-project-aliases))]
(binding [b/*project-root* project-dir]
(bb/clean {})
(bb/uber (assoc (:uberjar aliases)
:compile-opts {:direct-linking true}))
(bb/clean {}))))
b
= clojure.tools.build
, bb
= my build-clj
wrapper to provide defaults to clojure.tools.build
, and with-dir
is [clojure.tools.deps.alpha.util.dir :refer [with-dir]]
the comment in compile-clj makes me think I either forget something or process/java-command is not running from the right dir
;; java-command will run in context of project-dir - basis, classpaths, etc ;; should all be relative to that (or absolute like working-compile-dir)
Yes, we AOT. See the linked build-clj
code.
Are you explicitly building a basis? How/where? Note how we have to bind t.d.a's context separately to deal with reading/merging EDN files and extracting aliases. And we do all of the tools.build
stuff inside the binding
of *project-root*
yes, there's no merging going on, it's quite straightforward. we just run the command from a different project context than the one being compiled/uberjared
I ll step back and re-check the code that creates the basis, I was sure it was fine (it works for all the rest), but maybe I missed something
https://github.com/seancorfield/build-clj/blob/main/src/org/corfield/build.clj#L234 is the code for the uber
wrapper that does pom.xml
creation, copying files, compilation, and uber
all in one task.
The (:uberjar aliases)
piece pulls in options like
:uberjar
{:uber-file "../../../build/uberjars/api-1.0.0.jar"
:main api.main}
(and :main
causes :ns-compile
to be populated, as [api.main]
for the example above)
Feel free to share some of your build code via DM with me if you don't want to share it in the channel -- maybe I can spot what's wrong?
the error starts with one of the (compile 'foo.main) call in the generated script failing with a NPE (I guess it can't find the file)
Or perhaps the output path for the generated classes is missing/`nil`?
but I can definitely see it under /tmp/compile-clj1025453397036198757/compile-clj/foo/main.class
Hard for us to tell without seeing your scripts 🙂
if the compile-clj fails, it does not delete the temp dir where it's working
so you can go look at the entrails if that's helpful
you should be able to fully reproduce the step at that point
somehow the http://clj.co/compile call fails to find the clj file that has the main
Figured it out :) It is a bit convoluted I will spare you the details, but it's not caused by t.build or t.deps.