@nbtheduke would you like selling me on Just?
it's strictly the command runner part of make with sane defaults and a nice syntax
why would I want that? genuine question - what's wrong with just the tools at hand?
I want to do a full "lint and test" run of my linter splint. i could write
clojure-lsp diagnostics && bb run splint && bb run lazytest && clojure -M:v1.10:dev:test:runner --md README.md && clojure -M:v1.11:dev:test:runner --md README.md && clojure -M:v1.12:dev:test:runner --md README.md
or i could run just test-all-versionseach of the recipes in splint's justfile could be individual scripts, but they're not very big and it's nice to have them be able to reference each other
That's certainly preferable to scripts. Do you run it in CI? I guess one advantage could be making your repository more CI platform agnostic
FWIW bb tasks offers the same benefits (+ autocompletion) + you get a little bit more flexibility using clojure
Which makes me wonder why not just bb
my guess is shell scripting is easier in just
i'm not a fan of bb's task runner syntax. if i wanted to write clojure scripts (heh), i'd just write babashka files and then run them with bb. just lets me write the exact things i'd write from the command line into a file (with very light templating)
# Set version, change all instances of <<next>> to version
@set-version version:
echo '{{version}}' > resources/noahtheduke/splint/SPLINT_VERSION
fd '.(clj|edn|md)' . -x sd '<<next>>' '{{version}}' {}
sd '{{current_version}}' '{{version}}' README.md
sd '{{current_version}}' '{{version}}' docs/installation.md
sd '{{current_version}}' '{{version}}' docs/usage.md
sd '## Unreleased' '## Unreleased\n\n## {{version}} - {{today}}' CHANGELOG.md
Both just and bb are additional tools that need installing for dev/test/ci, yes? Although if you're using the Clojure GH Action, you get bb for "free" since it knows how to set that up... But just would be an additional install in GH Actions?
@nbtheduke Fair enough. I think bb might be a bit more OS-agnostic where you just use Clojure for most stuff instead of bash/GNU-related tools
i could write that in babashka or clojure itself, but i know and write fd and sd because they're simple and "unix"-y
I have never in my life used fd or sd
fd and sd aren't native Linux tho'...?
do they need to be? i'm writing for myself
OSS projects often doesn't come down just on yourself ;)
lol maybe i'll change when anyone else contributes to my projects π
I'm always leery of having a bunch of "stuff that needs to be installed" in order to run tests / build a project / whatever. That's really why I have even embraced bb fully yet (but I'm slowly coming around to that a bit).
the nice thing about just is that it's just (heh) command line calls. i used fd and sd to update the various files before i put it into a justfile recipe (what the collections of commands are called) because i know and use fd and sd in my day to day development. i already write clojure -M:dev:test:runner x100 a day, so putting it into a recipe and calling just test saves me a little bit of time and hassle
and because it's all command line calls, there's (almost) no new syntax or messiness to learn, i'm copying existing commands from my command line history into the file
i don't use just in GHA, i copy-paste the recipes into the appropriate yaml file because i also don't want to mess with additional tooling in CI
I run bb dev and bb test 100x a day probably :)
bb test would be:
{:tasks {test (clojure "-M:dev:test:runner")}}
using the built-in deps.clj clojure runner or
{:tasks {test (shell "clojure -M:dev:test:runner")}}
for shelling out to the system clojure command. Not that much syntaxyou don't need to defend babashka's test runner syntax to me, it's popular and well-used
just for anyone reading along.
(see what I did there? ;))
@nbtheduke I'm curious: do you use build.clj as well? Or would you just use just for that sort of stuff?
oh i use build.clj, but i mostly call it from my just recipes:
@clojars:
env CLOJARS_USERNAME='noahtheduke' CLOJARS_PASSWORD=`cat ../clojars.txt` clojure -T:build deploy
@borkdude Re: bb -- do you use build.clj as well? Or would you just use bb tasks?
@seancorfield We can discuss this in #babashka - I don't want to push bb tasks anymore here after Noah's remark ;)
oh you can talk about it, i was reading your comments as defensive because i said i didn't like the syntax. i don't mind the discussion, just didn't want you to think i was insulting your project
https://github.com/NoahTheDuke/splint/blob/5d5278fa9fbaaecabecb19e70e246b2ded773936/justfile#L84-L104 here's my "cut a new release" recipe that runs all tests, sets the new version, regenerates documentation, commits and sets the new tag, then compiles and deploys, and pings cljdoc to update the documentation
neh it's fine. I wasn't going to mention bb at all, but I couldn't resist after seeing very OS-specific stuff that I think would be friendlier to avoid in OSS projects since I think anyone should be able to build a Clojure project regardless of your OS
further bb tasks discussion here: https://clojurians.slack.com/archives/CLX41ASCS/p1753123384945069
except for fd and sd in a specific recipe (which i think has obscured the discussion a little), there's nothing in these justfiles that can't be used by anyone. they're basically named tutorials of how to do given tasks: run tests, build the project, open a repl, etc
a newcomer to splint says "i want to poke at splint, how do i run a repl like noah?" the justfile says clojure -M:dev:test:v1.12:repl
"i want to test the project", the justfile says clojure -M:dev:test:runner --md README.md -e :integration
"i want to run the integrations tests", the justfile says clojure -M:dev:test:runner --md README.md -i :integration
yeah. a lot of people use Makefiles for those still. Makefiles with lots of PHONY stuff. I don't like those a lot. Justfile is an improvement over that. But bb tasks still supports some of the features like dependent tasks and running stuff in parallel, which I bet Just does too. Just is a fine tool. bb tasks aims to do similar stuff but without the bash stuff.
What if there was another form for defining a bb task that just took a string literal to support this kind of simple representation?
I guess it would only be saving you a shell call or so.
I too was a just skeptic, at the time a Makefile or two was good enough for me.
I've come to appreciate just deeply for:
β’ Sane string interpolation
β’ Sane variable declaration
β’ #!/bin/bash scripts in the justfile, a few lines at a time.
(and it does give me a warm fuzzy to type just repl π)
Babashka tasks are my strong preference for a dev front-end. I always have bb installed, and don't mind at all imposing that it be installed for dev work for any open source project where I am a maintainer. I'm a true bbeliever though, and like to share the joy of using clojure tools and bb!
> bbeliever Heh, that's a neat word.
My kicker for embracing bb tasks was: β’ I can develop tasks from a REPL β’ I can let bigger tasks grow into Clojure programs I can run from the command line and from my REPL.
I've been using make for the same reason, to https://practical.li/engineering-playbook/build-tool/make/ across Clojure (and other language) projects. I still use make as its just shell commands and environment variables, so neutral ground especially when there are multiple languages at play. Make has been around for decades and I've been using it since 1994 π€£ Its usually installed on Linux machines already. I like the idea of just, but havet had the time to give it a try. I am very comfortable writing shell scripts, so haven't needed to use babashka yet (its on my todo list though)
So far I've gone for a simple (per-project) Bash script with a case on $1, so I typically run h repl, h test, etc. Recently I've started experimenting with using babashka for that script.
The file is put on my PATH by direnv, which incidentally also loads a Nix shell with all of the tools for the current project, so installing appropriate tools or adding a useful tool is never an issue.
#caveman also uses just iirc
I encountered just via #caveman and decided not to invest on the grounds that Iβm already pretty good at shell scripting and donβt need that reinvented. Now that this thread prompts me to think about it, many of the niceties just offers could be delivered via a shell script that you source, e.g. auto printing of available recipes/their docstrings
> Iβm already pretty good at shell scripting
Last time that line of thinking has gotten me into a need of deduplicated nested arrays in bash, so I decided to never think that way ever again. :D
(But not necessarily about just as I doubt it was something it could help with.)