borkdude / tools

Tools
19 stars 2 forks source link

lein2deps: add support for Java compilation? #4

Closed DerGuteMoritz closed 2 years ago

DerGuteMoritz commented 2 years ago

Leiningen supports compiling Java sources out of the box (via :java-source-paths). Supporting this to some degree would be desirable because it unlocks using libraries relying on this to be used as git dependencies. This requires generating a :deps/prep-lib task. In Aleph, we already have this. It also generates a build.edn file from the relevant Leiningen settings which is then consumed by a generic build namespace. Do you think including something like this in lein2deps is worthwhile?

Some background on the workflow in Aleph: The idea is to keep Leiningen around as the leading build tool (at least for now or maybe even indefinitely) and generate a deps.edn whenever we change project.clj which provides just enough to be able to use Aleph as a git dependency. We'd be happy to switch over to lein2deps so that we can share the maintenance burden for this.

borkdude commented 2 years ago

I think that's a nice addition!

DerGuteMoritz commented 2 years ago

Cool, glad you agree! I guess we have to decide on how exactly to go about this then. We could provide the cited generic build namespace from this repo which we'd then generate a git dependency on for the :build alias. Also, I just realized that we could just also put the contents of build.edn into deps.edn under a namespaced key within the :build alias and then read that from the build task itself. Adding it as :exec-args would be cool but :deps/prep-lib tasks are run via -T which (AFAIUI) don't support it. Will give it a try anyway, though. Sound good?

borkdude commented 2 years ago

Sounds good!

DerGuteMoritz commented 2 years ago

:+1: PR almost ready, only one thing to sort out: https://ask.clojure.org/index.php/12298/should-deps-prep-lib-honor-exec-args-in-the-build-alias

DerGuteMoritz commented 2 years ago

Figured that we don't have to wait for this to be fixed. Tested locally with Aleph and it appears to do the trick :+1: