I work on a Java/JavaScript app, and I had the thought that I could start developing a kind of SDK to help myself and other devs with testing
it has zero Clojure in it right now
I'm guessing, if I want to start putting some in, I start with our gradle configuration? I've worked in Clojure far, far more than I've worked in Java
That is what I do. Check out #gradle
I think of Clojure app development as starting with lein new...
so this is new territory
I actually wrote up an example repo that you might find useful this week for calling from Java into Clojure https://github.com/puredanger/clojure-from-java
oh cool
Stu also posted a clojure-from-java repo this week https://github.com/stuarthalloway/clojure-from-java
It takes a very different approach -- one that I've taken myself in the past.
yeah, I think mine is much less messy when you scale up
as you just write a small fixed amount of shim, and then the rest is in clojure
I think the key, in either approach, is to try to keep the interop API small, but I like that Stu's involves no compilation: just package .clj
files in with the Java using Maven (or "your current Java build tool").
It all gets more interesting when you start your Java app with the -D
to get a Socket REPL going 🙂
mine also does not require compilation
they overlap, I just make the bolder step of suggesting you should actually write your Java API in Java
Oh, looking at the repo it seemed to build an uberjar and compile files... are those just the Java files?
yes
no aot or genclass there
it is sort of like, if I am a java dev and want to use a random clojure library, how would I do it vs. if I am clojure dev and want to provide a nice interface for java programmers how would I do it
those are very different problems
I'm targeting the latter
for the former, that's not a use case Clojure is trying to target
there is some overlap in the solutions because they are both interoping in the same direction, but a different stance and priorities results in a different solution