Fork me on GitHub
#tools-deps
<
2019-07-02
>
ikitommi08:07:26

is there an example out there how to do mixed java + clj projects with deps?

lispyclouds08:07:36

@ikitommi AFAIK tool.deps doesn't support java compilation. Only way I know to get around it is build the java project separately and import it as a dep in deps.edn.

ikitommi08:07:17

thanks, but that was not the answer I was hoping for.

Olical09:07:36

I messed around with JNI stuff and deps.edn but basically did the compiling myself through a Makefile, probably not helpful but still. https://github.com/Olical/snowball

lispyclouds09:07:40

yeah I had asked about it a while back and got the answer. compiling java is beyond tools.deps scope i think and it makes sense

Alex Miller (Clojure team)12:07:29

My two suggestions are either to use an additional build tools around clj or to wall off your Java bits in their own project with their own artifact build

sogaiu12:07:54

haven't tried the following yet, but it looked promising: https://github.com/EwenG/badigeon

seancorfield13:07:03

@ikitommi you could always cheat and use the -e option to run clojure.java.sh and shell out to the Java compiler 😇😂🤪

clj 4
ikitommi13:07:21

great idea Sean 😉 did a external compile for my case, but puzzled that has the idea been that people would start using deps instead of boot or lein? Still need a “do-it-yourself” build tool on top - not the most welcoming newbie experience. Some official lein’ish battery-pack would be great?

ghadi13:07:11

newbies don't want to compile java 🙂

ghadi13:07:26

but battery-pack is something we've talked about

ewen15:07:23

badigeon can indeed compile java, let me know if you have any issue with it

hiredman17:07:33

someone in #core-async was having issues using badigeon to build an uberjar and the errors they were getting made me thing badigeon was double aot compiling core.async somehow, but looking at it again, I suspect badigeon may have an issue with timestamps so the clojure source files can end up being tagged with a newer time then the aot'ed code, which can break things

ewen11:07:42

@U0NCTKEV8 yes thanks you were right. I forgot to set the last modification time when moving files to a jar/zip archive

Travis15:07:02

I am about to try out badigeon myself for compiling some protobuf java classes

seancorfield15:07:54

@ikitommi Given how many beginners I've seen get tripped up with ~/.lein/profiles.clj in the last few months, I think there's a good argument for simpler tooling like the Clojure CLI. I've seen beginners struggle a lot less with the CLI than you might think.

seancorfield15:07:30

And, yes, as @ghadi says, "newbies" aren't trying to compile Java and Clojure together.

seancorfield15:07:43

At work, we do everything with the CLI and a small handful of (sharp) tools. We have a shell script purely to automate repeated sequences of clojure invocations.

dominicm16:07:41

@ikitommi in pack.alpha I do some clever stuff to compile java using the JDK api. Not much better than shelling out 🙂

dominicm16:07:03

I have toyed around with the idea of using the ztellman library for reloadable java with tools.deps but never actually done it.

dnolen17:07:21

@alexmiller circling back - the problem goes away if I supply a ClojureScript git dep version in the root project. Is the behavior I observed yesterday a bug, or just the current behavior? if I supply all the exclusions should I be able to avoid the warning about comparing versions?

Alex Miller (Clojure team)17:07:47

walking the full deps tree necessarily requires comparing versions of things, and comparing mvn to git is not (yet) supported (although I know how to do it)

Alex Miller (Clojure team)17:07:40

the question is whether in this particular scenario, with exclusions, the comparison can be avoided. exclusions are tricky and it's hard for me to answer that question without having the full scenario in hand.

dnolen18:07:36

@alexmiller ok when I made a minimal case :exclusions worked for me - so I guess -Stree can't be used reliably?

dnolen18:07:00

hrm I guess perhaps a comparison happens before you know it will be excluded?

Alex Miller (Clojure team)18:07:42

yes, and as you encounter more things, it's possible for the excluded state of something to change

dnolen18:07:55

verbose output just seems to confirm that my exclusions worked

dnolen18:07:17

but the end behavior is surprising

Alex Miller (Clojure team)18:07:18

-Stree tells you the end state, but is not the whole story of how it got there

dnolen18:07:28

since for the end user this doesn't seem deterministic

dnolen18:07:32

sometimes exclusions work

dnolen18:07:34

sometimes it doesn't

dnolen18:07:03

it also breaks using git deps transitively

Alex Miller (Clojure team)18:07:04

yes, there is a ticket in this area (specifically around cljs iirc, although not with a git dep)

dnolen18:07:10

it can't be done safely

dnolen18:07:26

so you have to re-declare your deps at the bottom

Alex Miller (Clojure team)18:07:41

I think you are jumping to conclusions that are not necessarily true

dnolen18:07:06

so you have some way to avoid the above?

dnolen18:07:32

I have to re-declare my git deps right now

Alex Miller (Clojure team)18:07:57

it is possible to declare deps trees that are either logically inconsistent (impossible to satisfy the deps and exclusions as stated across the tree) or that are ambiguous

dnolen18:07:17

but that's not what I've described above

Alex Miller (Clojure team)18:07:32

well you haven't given me a repro, so I can say either way

dnolen18:07:06

yeah I don't know how make this one since it's non-trivial project with non-trivial deps

dnolen18:07:12

it works in the trivial case

dnolen18:07:15

other git stuff won't appear in -Stree?

Alex Miller (Clojure team)18:07:50

-Stree should be the full tree of everything chosen at the end (it's just the inverted lib map which you can find in the .cpcache in the .lib file)

Alex Miller (Clojure team)18:07:20

so other git stuff will appear there

Alex Miller (Clojure team)18:07:53

it does not list things that were children but not chosen (due to exclusions or version selection or being dominated by a top dep)

Alex Miller (Clojure team)18:07:14

sorry, I have to run to the dentist

dnolen18:07:22

one second maybe I see a way to repro now

dnolen18:07:29

k, will drop a link to something minimal if I can make it

dnolen20:07:44

I found the issue which arose from a misunderstanding on my part

dnolen20:07:47

I had a project which delcared a ClojureScript dep - and of course there were transitive deps that also declared ClojureScript but no conflicts because I guess clj considers the deps.edn :deps to be overrides?

dnolen20:07:19

once I was using that project transitively - those became conflicts

dnolen20:07:35

I had removed the conflicts from the downstream project, but not this upstream one

Alex Miller (Clojure team)20:07:27

On your question above about overrides, I’m not sure what you mean but I suspect you’re making up a model there. Top level deps are always taken as overriding decisions of the transitive deps

dnolen20:07:08

that's what I meant

Alex Miller (Clojure team)20:07:14

When you move to your “upstream” project though, the deps of the “downstream” project are no longer top deps

dnolen20:07:18

"top-level"

Alex Miller (Clojure team)20:07:41

So are subject to other selections

dnolen20:07:48

yeah that was the model I came up w/ based on what I saw

dnolen20:07:52

so good to hear that confirmed