Fork me on GitHub
#tools-deps
<
2021-01-29
>
mpenet14:01:37

what's the uberjar alternative "du jour" ?

mpenet14:01:43

something rock solid

mpenet14:01:04

I mean a clj plugin that would replace lein uberjar

dharrigan14:01:35

I use seancorfield/depstar in my deps.edn

dharrigan14:01:08

: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}}}

mpenet14:01:20

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

mpenet14:01:37

oh it's supports aot even

borkdude16:01:58

for deps.edn depstar is my thing now too

1
seancorfield18:01:00

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
KevinK19:01:30

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!

seancorfield19:01:22

@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).

alexmiller19:01:23

not possible

borkdude19:01:25

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

borkdude19:01:14

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.

KevinK19:01:29

awesome, thanks a lot!

Jason21:01:03

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?

borkdude21:01:39

@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?

alexmiller21:01:17

I think we have a pending jira about submodules

alexmiller21:01:21

in that they don't work

borkdude21:01:47

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?

Jason22:01:48

@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

borkdude22:01:37

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

alexmiller22:01:21

is this polylith?

alexmiller22:01:35

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

seancorfield22:01:15

Ah, that might explain why @tengstrand (I think) reached out to me via DM with questions about our monorepo setup with deps...

Jason22:01:21

@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

borkdude22:01:06

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.

Jason22:01:49

@borkdude Thanks, will do

seancorfield22:01:15

Ah, that might explain why @tengstrand (I think) reached out to me via DM with questions about our monorepo setup with deps...

seancorfield22:01:42

@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.

tengstrand03:01:57

Yes, it was me that reached out to you @seancorfield, and here is the issue (https://github.com/polyfy/polylith/issues/66) including a discussion with Alex about the #polylith workspace structure.

seancorfield05:01:50

Yeah, every time I've looked at Polylith it's just looked like overkill formalism -- and I think the rigidity you've adopted is part of what's causing you problems with deps.edn and tooling. I agree with Alex's comment that you're aiming at an "easy" solution instead of "simple" as well and that's also causing you headaches.

seancorfield06:01:02

BTW @tengstrand I notice that your #polylith channel here does not have either @U055W814A or @UFNE73UF4 as members so none of that conversation is being logged anywhere, and therefore isn't searchable. You might want to add both of those bots to improve the discoverability of your discussions.

tengstrand21:02:40

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.

seancorfield22:01:29

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.

seancorfield22:01:53

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

borkdude22:01:11

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

seancorfield22:01:55

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

borkdude22:01:56

yeah, it kind of does, I guess

seancorfield22:01:05

But it excludes your own user deps.edn.

seancorfield22:01:18

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

borkdude22:01:21

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

seancorfield22:01:40

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

borkdude22:01:42

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

borkdude22:01:08

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

seancorfield22:01:26

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

seancorfield22:01:06

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

seancorfield22:01:40

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

seancorfield22:01:06

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

alexmiller22:01:22

I haven’t forgotten it :)

Jason22:01:30

@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.