Fork me on GitHub
#tools-deps
<
2021-10-07
>
fadrian11:10:20

I have a project structured as follows: | + --- deps.edn | + --- src <-- Some sources here | + ---+ more-code <-- Library sources here | | . + --- module1 <-- Source tree . + --- module2 . . . . I've tried using :paths ["src" "more-code"] in my deps.edn file (as well as :paths ["src"] deps:["more-code"}), but this doesn't seem to recursively search into the subdirectories of the more-code directory, because when I try to refer to a namespace in src/x.clj which has its namespace defined in (say) module2/foo/src/foo/core.clj, this namespace is not found. The only thing I've found that comes close to working seems to be using :extra-deps {foo/module1 {:local-root "more-code/module1/foo/src"} foo/module2 {:local-root "more-code/module2/bar/src"} ... <for all namespaces referenced in src>} which seems clunky, repetitive, and not maintainable, especially when the namespace structures south of the more-code tree become complex. What am I doing wrong?

souenzzo02:10:49

@U0DTU8J83 • it is :local/root, not :local-root:local/root should point to another folder with a deps.edn file. • you can have many "some sources" folders, like src, you can simply point ["src" "more-code/module1"]

respatialized21:10:54

is there a way to use an already-defined var for an input argument to a function defined via :exec-fn? If I have a namespace like this:

(ns foo.bar)

(defn my-func [{:keys [a b]}] (inc a))
(def my-val 3)
and an :aliases map like this:
{
...
:my-func {:ns-default foo.bar
           :exec-fn my-func
           :exec-args {:a my-val}}
...}
I get the following error:
Execution error (ClassCastException) at foo.bar/my-func
class clojure.lang.Symbol cannot be cast to class java.lang.Number
Is there a way to tell exec-fn to resolve the symbol at execution time, or is this not possible? It doesn't seem like the #' reader macro works in edn, so I can't use that method to ensure the symbol is treated as a var.

Alex Miller (Clojure team)21:10:33

no, you can't do this, although you could wrap my-func in something else that uses my-val

1
respatialized21:10:50

That's the solution i landed on, but wanted to confirm. Thanks!