tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
2021-02-07T14:44:49.188200Z

If you like clj but miss the group dynamics that leiningen provided (with known names bound to actions), I whipped up a small joker script that provides support for common cases: https://gist.github.com/pyr/d5e17af9c572b681a57de52895437298. It allows doing klein {deps,run,repl,jar,uberjar,test} and supports inferring artifact versions from the command line. I'll see about turning it into a real repo, if there's any interest

2021-02-07T14:46:35.190Z

It's missing a number of things (`new`, compile, javac, and support for submodules which we use extensively).

borkdude 2021-02-07T15:28:09.198Z

@pyr This is awesome! I made a babashka fork here. The changes are fairly minimal. https://gist.github.com/borkdude/c34e8e44eb5b4a6ca735bf8a86ff64fa

tengstrand 2021-02-07T15:38:20.201200Z

Would it be possible to support giving the name of the config file that should be used when executing a command (if it's something else than deps.edn) so that e.g. the 'poly' project config file could also live at the root along with 'deps.edn', and e.g. be named 'poly-deps.edn'. That would solve our problems we have in #polylith because then we could put all our project files at the root and refer to the source directories without using relative paths (all paths would then look like e.g. "components/mycomp/src"). I have started the work to support the new project structure where each component has its own deps.edn. I would like the different project deps.edn files to handle the components consistently, so that we either specify :paths and :extra-paths or :deps and :extra-deps for all projects. Mixing the two ways doesn't make sense, but if we could put all the project files at the workspace root, then we could more or less keep it as it is without referring to paths outside the projects.

borkdude 2021-02-07T15:42:23.201400Z

It's not the official clojure deps runner, but my deps.clj project supports this with -Sdeps-file: https://github.com/borkdude/deps.clj

tengstrand 2021-02-07T16:16:00.201800Z

Okay, interesting. But it needs to work for Datomic cloud also. I just talked with @furkan3ayraktar and he said that we can't use :deps or :extra-deps for our single development environment, the deps.edn at the root "The reason we can’t use local/root approach in the root dep is that the REPL doesn’t work. You’ll loose the single dev environment and you can’t run tests from the REPL in that case.". So if we can't have all our project files at the root, we need to have a mix where we specify the paths for the development project and dependencies for all other projects. With the support that you have added, we could keep it consistent and simpler and it would make much more sense also, because there are no difference between the projects except that they contain a different set of building blocks. Maybe we could add an issue together.

borkdude 2021-02-07T16:28:34.202Z

There has been some discussion about a fourth deps.edn file (system, user, project, fourth) or n deps.edn files. cc @seancorfield and @alexmiller

alexmiller 2021-02-07T16:47:19.203400Z

I do not currently expect that is where we will end up

tengstrand 2021-02-07T17:05:51.203600Z

Okay, good to know.

2021-02-07T17:36:16.203800Z

really nice. I will play with the two and compare output sizes/times thanks!

seancorfield 2021-02-07T18:29:28.204Z

@alexmiller is there any guidance you can offer at this point on what is likely to be the direction?

alexmiller 2021-02-07T18:45:00.206100Z

No, not trying to be coy. We are having ongoing discussions about combinations of features, problems, future directions, etc. It’s just hard to discuss without hours of context.

seancorfield 2021-02-07T18:50:58.210200Z

I look forward to several posts on Inside Clojure summarizing the possible solutions you discarded and why they wouldn't work 🙂

alexmiller 2021-02-07T19:05:49.211700Z

unlikely to ever get that. It’s just too hard to recreate multidimensional design discussions between a bunch of people over weeks/months.

seancorfield 2021-02-07T19:07:25.211900Z

🙂 Then I'll just look forward to whatever solution y'all eventually decide on and adjust our monorepo accordingly...

borkdude 2021-02-07T19:08:58.212100Z

since tools.deps is a tool/lib, I can imagine some scripting on top of this can make any solution you want already. it's just not the official blessed bash script.

borkdude 2021-02-07T19:09:46.212400Z

but deps.edn generation is always a way out as well

seancorfield 2021-02-07T19:11:39.212600Z

Yeah, that is also a direction I've considered -- but now that we are not using CLJ_CONFIG and we generate our "compound" deps.edn file, it's opened up the possibility to use clojure directly instead of having to use our build shell script... so I'm not thrilled about the idea of forcing developers back to a custom script 😐

seancorfield 2021-02-07T19:12:07.212800Z

Even with CLJ_CONFIG, we could use clojure directly: it was just rather verbose.

borkdude 2021-02-07T19:13:14.213Z

I now have custom clojure bash scripts in our mono-repo projects. These are also used by tools like clojure-lsp to calc the classpath

borkdude 2021-02-07T19:14:07.213200Z

so instead of clojure -Sfoo you type ./clojure -Sfoo. Not custom as in a fork of the original, just something like CLJ_CONFIG=../base clojure -A:base. I guess what you had before

seancorfield 2021-02-07T19:15:11.213400Z

Yeah, we vendor clojure into our repo so we have a reliable, self-contained version, using a specific install path. But it's still "almost" identical to the official version. I'm trying not to fork it and diverge.

seancorfield 2021-02-07T19:18:59.213700Z

(! 856)-> diff clojure/bin/clj `which clj`
2c2
< vendor_path=/var/www/worldsingles/build/clojure
---
> 
4c4
<   exec rlwrap -r -q '\"' -b "(){}[],^%#@\";:'" ${vendor_path}/bin/clojure "$@"
---
>   exec rlwrap -r -q '\"' -b "(){}[],^%#@\";:'" clojure "$@"

Sun Feb 07 11:17:40
(sean)-(jobs:0)-(/Developer/workspace/wsmain/build)
(! 857)-> diff clojure/bin/clojure `which clojure`
2c2
< vendor_path=/var/www/worldsingles/build/clojure
---
> 
246c246
< install_dir=${vendor_path}
---
> install_dir=/usr/local/Cellar/clojure@1.10.2.774/1.10.2.774
That's the sum total of our changes (compared to the brew install'd version).