tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
mpenet 2021-01-29T14:56:37.070900Z

what's the uberjar alternative "du jour" ?

mpenet 2021-01-29T14:56:43.071100Z

something rock solid

mpenet 2021-01-29T14:57:04.071500Z

I mean a clj plugin that would replace lein uberjar

dharrigan 2021-01-29T14:57:35.071900Z

I use seancorfield/depstar in my deps.edn

mpenet 2021-01-29T14:57:41.072100Z

there are a lot of them https://github.com/clojure/tools.deps.alpha/wiki/Tools#packaging

dharrigan 2021-01-29T14:57:44.072300Z

i.e.,

dharrigan 2021-01-29T14:58:08.073300Z

:uberjar {:replace-deps {seancorfield/depstar {:mvn/version "2.0.165"}}
                     :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
                     :exec-fn hf.depstar/uberjar
                     :exec-args {:jar foo.jar
                                 :group-id bar
                                 :artifact-id foo
                                 :version "0.0.0"
                                 :main-class foo.bar.main
                                 :aot true
                                 :sync-pom true}}}

mpenet 2021-01-29T14:58:20.073600Z

@dharrigan ah right. they also uses that extensively I think, so it's a good bet I guess

dharrigan 2021-01-29T14:58:30.073800Z

np 🙂

mpenet 2021-01-29T14:58:37.074Z

oh it's supports aot even

borkdude 2021-01-29T16:29:58.074300Z

for deps.edn depstar is my thing now too

1
seancorfield 2021-01-29T18:30:00.075500Z

And there's a #depstar channel for questions/problems. I'm working on a new release today (that will remove the pom.xml requirement for folks who want to ignore/omit that, amongst other things).

đź‘Ť 1
KevinK 2021-01-29T19:34:30.079100Z

I know theres a way to add dependencies with add-lib3 branch of tools.deps.alpha. but is there a way to change a dependency in a running repl? e.g. change a dependency from being a Maven provider to a local provider and then reload the namespacees so you can use the local code instead? might not even be possible on the jvm but I don't know for sure. Thanks!

seancorfield 2021-01-29T19:37:22.081300Z

@kevin.krausse Assuming it is Clojure source code, you could probably do it manually by editing up the various source files in that local repo and evaluating them into your REPL (but you can't do it via dependency management AFAIK).

alexmiller 2021-01-29T19:37:23.081400Z

not possible

borkdude 2021-01-29T19:37:25.081500Z

Sounds like a hack to me that's more trouble than its worth :)

borkdude 2021-01-29T19:39:14.082300Z

What Seancorfield describes is something I've been doing regularly pre deps.edn, when e.g. debugging libs from clojars. Just copy paste the file from the jar and REPL on.

KevinK 2021-01-29T19:41:29.082700Z

awesome, thanks a lot!

Jason 2021-01-29T21:53:03.088500Z

Is there a way to include an external deps file from, say, a git submodule in a project's deps file? I'm trying to give other devs access to clojure-deps-edn without either 1. making them modify their dot clojure since this is project-level from their perspective 2. hand-editing the project's deps I can add 'clojure-deps-edn' as a git submodule but how best to wire it at the project level?

borkdude 2021-01-29T21:57:39.089300Z

@jasonhlogic if you use the git submodule as a local/root dep, the top-level deps.edn will also pull in the deps of the submodule deps, right?

alexmiller 2021-01-29T21:58:17.089800Z

I think we have a pending jira about submodules

alexmiller 2021-01-29T21:58:21.090Z

in that they don't work

alexmiller 2021-01-29T21:59:04.091100Z

https://clojure.atlassian.net/browse/TDEPS-126

borkdude 2021-01-29T21:59:47.092400Z

deps.edn {local/root: submodule}
submodule/deps.edn {cheshire, transit, paths: [src]}
now deps.edn will also include cheshire, transit and the submodule src path?

Jason 2021-01-29T22:02:48.095200Z

@borkdude I have an additional complicating factor: This is a fullstack app so the top-level has no project. There are several subprojects under /projects with their own deps files. I'm certainly willing to edit each deps file, but if I can only depend on filesystem hierarchy to get to submodules then i'm still out of luck

borkdude 2021-01-29T22:05:37.095900Z

@jasonhlogic Your goal is to include a set of libraries in each of the submodules? Or something else?

alexmiller 2021-01-29T22:07:21.096900Z

is this polylith?

alexmiller 2021-01-29T22:08:35.098600Z

if so, I think you should file an issue with them as I've been having similar discussions about this structure

Jason 2021-01-29T22:10:21.100Z

@borkdude My goal is to provide access to practicalli/clojure-deps-edn , which while technically including other libraries, is more like "additional tooling" than "additional libraries". I was hoping for something like an :include in deps files

borkdude 2021-01-29T22:11:27.100200Z

ah

borkdude 2021-01-29T22:13:06.101500Z

The way I would solve this right now is very bluntly, like this: - make one template edn, like https://github.com/babashka/pod-babashka-aws/blob/main/deps.template.edn - write a script: https://github.com/babashka/pod-babashka-aws/blob/main/script/update-deps.clj - update deps.edn with tooling using script. There is no support in tools-deps for this right now afaik.

Jason 2021-01-29T22:13:49.102200Z

@borkdude Thanks, will do

seancorfield 2021-01-29T22:29:42.106Z

@jasonhlogic For a while, we were using the CLJ_CONFIG "hack" to select a "user" deps.edn file for combination with a subproject's deps.edn file in our monorepo. But that's problematic because then developers can't have their own tooling setup. So eventually we caved and went to a deps-generation approach. Each subproject has <subproject>-deps.edn and we have a small Clojure script that reads that and the "common" deps template and merges them and spits out deps.edn. We keep .md5 checksums of all the template files and we automatically regenerate them in our build script (which wraps clojure) if either the common or subproject template has changed.

tengstrand 2021-02-01T21:35:40.141100Z

We agree that the #polylith way of structuring code is opinionated and we respect that you (@seancorfield) think it’s overkill formalism, but we don’t agree. Polylith may look alien to people, in the same way Clojure looks like a bunch of parenthesis, added for no apparent reason. But the parenthesis are there to solve fundamental problems, and the same is true for Polylith. It is no coincidence that a component lives in its own src directory, that it’s just “plain code”, that it has an interface, that it’s only allowed to depend on interfaces (and libraries) and that it lives in a monorepo. All those things are there to decouple our system(s) into small Lego-like bricks in a way that they can be shared and put together in a meaningful way. Components are very similar to functions in that way, but operate on a higher level. A function is composable, easy to reason about, has a well defined interface and is fundamentally simple. A component is also composable, easy to reason about, has a well defined interface and is fundamentally simple.  Teasing things apart so that they can be composed together is often a sign of good design. It has been as hard to convince people that Polylith is a good idea as it has been to convince them that Clojure is. Our experience though, is when they start using either of them, they will soon discover how simple they are, how fun they are to work with and how productive you get, and that’s why we love Clojure and Polylith.

seancorfield 2021-01-29T22:30:29.106800Z

Since we were already generating an "everything" deps.edn -- so we could easily start a REPL with all of our monorepo's code and all the dependencies for our dev work.

seancorfield 2021-01-29T22:30:53.107400Z

Basically, it's like Polylith without the rigid formalized module interfaces.

borkdude 2021-01-29T22:31:11.107800Z

The CLJ_CONFIG hack doesn't work for his case, since he wants to include basically aliases from another deps.edn file

seancorfield 2021-01-29T22:31:55.108700Z

CLJ_CONFIG=path/to/that/deps clojure -M:aliases:from:that:deps:and:other:aliases works though.

borkdude 2021-01-29T22:31:56.108800Z

yeah, it kind of does, I guess

seancorfield 2021-01-29T22:32:05.109100Z

But it excludes your own user deps.edn.

seancorfield 2021-01-29T22:32:18.109700Z

It's how we worked for a year or so.

borkdude 2021-01-29T22:32:21.109800Z

I was thinking of the nil version in combination with CLJ_CONFIG, which is what we are using it for

seancorfield 2021-01-29T22:32:40.110400Z

We use {} for the version and :override-deps in the master deps file.

borkdude 2021-01-29T22:32:42.110600Z

but I'm thinking of using a scripting + template approach instead, feels more robust

borkdude 2021-01-29T22:33:08.111200Z

at least the deps.edn you see is the deps.edn you get

seancorfield 2021-01-29T22:33:26.111700Z

We had a :defaults alias in the common deps file. Well, we still do, but that's in the common deps template now 🙂

seancorfield 2021-01-29T22:35:06.113400Z

Yup, local deps getting updated still breaks stuff though -- but that's a known issue with the CLI/t.d.a already.

seancorfield 2021-01-29T22:35:40.114Z

Having the ability to add an extra deps.edn file into clojure's invocation, between user and project, would solve this.

seancorfield 2021-01-29T22:36:06.114500Z

@alexmiller I gather folks are still asking for that "fourth file" in various guises?

Jason 2021-01-29T22:49:30.117300Z

@seancorfield I can make that work. Thanks for the suggestion. Happily, we already use https://github.com/casey/just (non-clojure but useful) to package commands for devs and devops, so I can use that to add the environment hack you suggest.

alexmiller 2021-01-29T22:56:22.117800Z

I haven’t forgotten it :)