Fork me on GitHub
#tools-deps
<
2023-01-28
>
Benjamin11:01:08

:lib/hotload
           {:extra-deps {org.clojure/tools.deps.alpha {:git/url ""
                                                       :git/sha "e4fb92eef724fa39e29b39cc2b1a850567d490dd"}
                         org.slf4j/slf4j-nop {:mvn/version "1.7.36"}}}
I have this in .clojure/deps.edn and it is useful. But when I start clj in a project that brings in a real slf4j, I get warnings. Any way to say "don't add slf4j if I already have one". I just had the idea that I make a second alias for projects where I don't want slf4j-nop

practicalli-john20:01:41

I included the slf4jnop to suppress the slf4j warning if there is not an implementation added to the class path. I haven't used slf4j for a few years now (I use mulog) so don't know if there is a nicer way around this. If including slf4j in most or all projects, I suggest removing the slf4j-nop library from the alias

Benjamin08:01:27

👍 thanks for the great work and community effort btw 🙂

đź‘Ť 2
dominicm12:01:59

Congrats on leaving alpha!

(clojure.tools.deps.util.dir/with-dir (java.io.File. "/tmp")
    (create-basis nil))
Just noodling about fixing support for toolsbuild/project-root and decided to go straight to tools.deps.alpha. Unfortunately the above code leaves :paths with relative directories still. It doesn't look like util.dir is documented so I am reluctant to rely on it but in order to relativize the :paths consumption out of the basis I will have to. Not a big deal because I can just detect relative paths and handle them, but I thought it was worth a note.

Alex Miller (Clojure team)13:01:54

Can you back up and tell me what you’re trying to do? Are you in tools.build or using tools.deps directly. If the former, you should be changing the project root instead

dominicm13:01:09

I'm using a library based on tools deps

Alex Miller (Clojure team)13:01:07

I’m happy to help but you’re going to have to give me way more context if you want me to do so

dominicm14:01:36

My library consumes the basis from deps.edn, and produces docker images, jars, etc. The problem is that currently nothing like project-root is supported, so my library was reading :paths from the cwd rather than relative to deps.edn

Alex Miller (Clojure team)15:01:50

I’m confused by many things here. You opened by talking about moving out of alpha, then said alpha later. I don’t know if that’s relevant or not. You mentioned tools.build but it’s unclear if you’re using that or using it as reference. You’ve mentioned “my library” but I don’t know what library, why no name or link. You said “consumed the basis” - this can mean many things. Is this the code above or something else? In that code, it’s unclear to me if something has changed or if you are changing something, what results you expect, what results you’re getting, etc.

Alex Miller (Clojure team)15:01:40

Nothing material has changed recently in how any of this works. Im unclear if you are seeing a difference you don’t expect, or not seeing some difference you do expect

Alex Miller (Clojure team)15:01:32

The dir ns has tools to set a directory context (effectively a cwd that can change), and you should use that if you are creating a basis in a context other than the current directory

Alex Miller (Clojure team)15:01:02

The :paths in the basis are just the paths in the deps.edn so are always relative

Alex Miller (Clojure team)15:01:11

If you’re looking for the output classpath paths, those are in the :classpath and :classpath-roots keys and should be absolute

dominicm16:01:30

I'm no longer on the alpha tools deps in the library. Transition was pretty seamless. The user issue mentioned tools build, but I'm using tools deps in my library. The library is pack.alpha, which builds jars, docker, etc. https://github.com/juxt/pack.alpha/ I think I was seeing relative paths in the :classpath for things specified in the roots deps.edn. Nothing has changed here, but everything else including local deps were converted to absolute paths so I was unsure if it's a bug.

dominicm19:01:55

https://github.com/juxt/pack.alpha/issues/114 here's the user issue for reference, and the related commits