Fork me on GitHub
#tools-deps
<
2021-09-29
>
cfleming03:09:49

I am trying (once again) to see if I can use deps to manage the dependencies for Cursive, which is tricky because it’s a mixed-language project. I’m almost there, with some fiddling, some babashka scripting, and some hackery. I have one thing blocking me now - creating a dependency between two deps projects in a way that sort-of mimics what Maven would do. The dependency is on a Java-only project, so I need to create a dependency on the compiled class files in some way for compiling the dependent module. Has anyone done anything like this?

lread03:09:44

@cfleming, would a :local/root dep pointing to a jar file work for you here?

cfleming03:09:51

It would, but it’s not ideal since I’d have to ensure that the dep was built and compiled into a jar in order to be able to build the dependent project. I’m trying to figure out a way that will also work with IntelliJ’s compile process, and that’s tricky.

lread03:09:53

Oh, sorry not familiar with IntelliJ compile process.

cfleming03:09:23

No worries. If you’re more familiar with Maven, it would be the equivalent of requiring a sub-project to be published into the local Maven repo in order to compile anything using it, which isn’t impossible but is annoying.

lread03:09:33

We are using babashka tasks over at graal-build-time as a kind of make. I don't know if that type of thing would hook in at all for you though. There was a time when I was familiar with Maven, but those memories have faded...

cfleming03:09:41

Yes, I’m already using babashka tasks to generate and update all the deps.edn files I’m using. It works great for setting the project up, but I just can’t get this last bit to work.

lread03:09:57

Sorry I can't be of more help, but I do offer you moral support 🙂

cfleming03:09:33

Thanks! I have at least a blog post’s worth of material now…

lread03:09:21

Awesome, I look forward to reading all about it!

borkdude06:09:47

@cfleming there is prep lib now for on the fly compilation, would that help? Exact details should be in the reference (on the phone)

cfleming02:09:15

In the end I realised that what I needed was an IntelliJ-specific thing, likely only useful to me. So I added support for that, Cursive will now treat dependencies that look like:

cursive/jps-plugin:module {:local/root "jps-plugin"}
(local root with :module suffix on the key) as special, and I just hide those deps in an alias so that only Cursive sees it.

cfleming02:09:22

I’ll document it in case anyone else wants to use deps for managing non-Clojure projects with Cursive, though.

athomasoriginal12:09:40

RE: help/doc If I have a :build alias in my deps.edn and it has a proper ns doc string should I be able to run clojure -A:deps -T:build help/doc or is this currently strictly only for non-project tools?

athomasoriginal12:09:15

Interesting. When I run clojure -A:deps -T:build help/doc (clj version: 1.10.3.986) I get:

Namespace could not be loaded: help

seancorfield17:09:38

@tkjone Is it possible you have your own :deps alias, shadowing the root version?

athomasoriginal17:09:45

Doesn’t look like. I actually pulled down next-jdbc github repo and tried running the same command for that lib and I get the same result. I am assuming it works for you though?

seancorfield17:09:54

Works for me:

(! 620)-> clojure -A:deps -T:build help/doc
Checking out:  at 2ceb95afd9c60072a7a0646a4bb4d53615c6770b
next.jdbc's build script.

  clojure -T:build ci
  clojure -T:build deploy

  Run tests via:
  clojure -X:test

  For more information, run:

  clojure -A:deps -T:build help/doc

-------------------------
build/ci
([opts])
  Run the CI pipeline of tests (and build the JAR).
-------------------------
build/deploy
([opts])
  Deploy the JAR to Clojars.
-------------------------
build/test
([opts])
  Run all the tests.

seancorfield17:09:13

Are you sure you don't have a :deps alias in your ~/.clojure/deps.edn file?

athomasoriginal17:09:21

and that was indeed the problem facepalm

seancorfield17:09:18

My dot-clojure used to have a :deps alias too, but I renamed it to :add-libs https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn#L96

🙏 1