Fork me on GitHub
#cursive
<
2021-02-24
>
favila16:02:26

I have a large monorepo full of deps edn modules and unfortunately some of them have the same directory name (not full path, just name). This causes cursive/intellij to error silently. Is there any way around this short of renaming the dirs? manually renaming the module in project structure doesn’t seem to stick.

favila17:02:44

I’m also having a problem where vars across :local/root deps.edn dependencies cannot be resolved, but their namespaces can (i.e. I can control-b the namespace and appear in the right one). Same monorepo project.

favila17:02:11

Possibly related: I have deps with no names. Here’s one of the deps.edn project which has a dependency on two other projects in the same monorepo (they’re sibling directories)

cfleming19:02:35

I’ve never seen that, I’ll see if I can figure out how that might happen. What do the dependencies for those two look like in the deps.edn file?

favila19:02:17

with considerable trimming, it looks like this:

{:aliases
  {:backend-defaults
   {:default-deps
    {io.clubhouse.module/logging
     {:local/root "../logging", :deps/manifest :deps},
     io.clubhouse.module/dev-shared
     {:local/root "../dev-shared", :deps/manifest :deps}}},
   :test
   {:extra-paths
    ["test"],
    :extra-deps
    {io.clubhouse.module/dev-shared nil}}},
  :paths
  ["src" "resources"]
  :deps
  {io.clubhouse.module/logging nil}}

favila19:02:45

Maybe the :backend-defaults alias is the problem and should be pulled up

favila19:02:51

I’ll try that

favila19:02:48

that alias is always active in the “aliases” panel of the clojure deps tool window

favila19:02:15

woops, my mistake, default-deps is only allowed in aliases

favila20:02:52

yeah, that’s definitely it. If I inline the local/root coordinates those empty deps entries go away. This also fixes name resolution. Probably at project-setup time that alias is not enabled.

favila20:02:49

I.e. this works:

{:aliases
  {:backend-defaults
   {:default-deps {}},
   :test
   {:extra-paths
    ["test"],
    :extra-deps
    {io.clubhouse.module/dev-shared {:local/root "../dev-shared", :deps/manifest :deps}}}},
  :paths
  ["src" "resources"]
  :deps
  {io.clubhouse.module/logging 
     {:local/root "../logging", :deps/manifest :deps}}}

cfleming20:02:36

Thanks, I’ll try to reproduce that with those examples.

favila20:02:46

This also fixes the “namespace not in scope” problem when reloading in the repl

cfleming00:02:55

So the problem seems to be that when deps are pulled in through :default-deps, deps doesn’t normalise the paths to absolute paths. This using your first (broken) example:

~/d/c/f/main> clj -Stree -A:backend-defaults:test
org.clojure/clojure 1.10.2
  . org.clojure/spec.alpha 0.2.194
  . org.clojure/core.specs.alpha 0.2.56
io.clubhouse.module/logging ../logging
io.clubhouse.module/dev-shared ../dev-shared

cfleming00:02:34

Using your second (working) example:

~/d/c/f/main> clj -Stree -A:backend-defaults:test
org.clojure/clojure 1.10.2
  . org.clojure/spec.alpha 0.2.194
  . org.clojure/core.specs.alpha 0.2.56
io.clubhouse.module/logging /Users/colin/dev/cursive-bugs/favila-deps-issue/logging
io.clubhouse.module/dev-shared /Users/colin/dev/cursive-bugs/favila-deps-issue/dev-shared

cfleming00:02:53

Here, the two libs come in via :extra-deps and top-level :deps, and they are both absolute. Either way, for robustness the Cursive fix is easy, I should just absolutise those even if deps doesn’t.

cfleming00:02:44

cc: @U064X3EF3 in case this is of interest.

favila00:02:18

This is ringing a bell. I think I had to write some sed to mess with the classpath dumped out of clj tools. I’ll have to look up the details, it might be the same issue

cfleming00:02:49

Yeah, I guess the classpath will only work when the Java process is invoked from the project directory.

alexmiller03:02:00

I can look at that

cfleming07:03:16

@U09R86PA4 I’ll try to get the fix for this out in an EAP tomorrow.

favila21:03:47

FWIW, :override-deps seems to have the same problem 🙂

cfleming21:03:17

Ok, I’ll fix that too 🙂

cfleming22:03:57

Actually, the same fix works since it just absolutises all the lib paths now.

alexmiller19:02:50

:local/root dependencies will not force a cache recompute when deps change - that has to be forced with -Sforce

alexmiller19:02:59

not sure if that's what you're seeing, but a good thing to check

cfleming19:02:28

I don’t think that caching is the issue here, since Cursive only uses t.d.a and the caching happens in the script (IIRC)

cfleming19:02:05

I need a better way of handling duplicate names, too - I’m still not sure what to do about that.