babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
mike_ananev 2021-04-20T07:15:19.288700Z

how to prevent exit for (shell...)if exit code is not 0 ? I would like to continue bb script execution.

borkdude 2021-04-20T07:29:44.290100Z

@mike1452 Not possible yet with that one but you can use babashka.process or clojure.java.shell as an alternative

mike_ananev 2021-04-20T07:38:02.290600Z

got it. thanks.

borkdude 2021-04-20T10:23:58.291300Z

Found another good use for fs/modified-since: https://gist.github.com/borkdude/35bc0a20bd4c112dec2c5645f67250e3#file-1-bb-edn-L2-L5 We rebuild our deps.edn from a template when any relevant files on which it depends changes, when invoking any task.

2πŸ‘
wilkerlucio 2021-04-20T19:54:14.292300Z

currently in babashka tasks, is there a way to invoke one task from another? (other than using :depends, I like to have more control over the execution order)

wilkerlucio 2021-04-20T19:55:27.293300Z

I can understand if there is a design decision to not allow that ,just wanna make sure I’m just not missing the syntax πŸ™‚

borkdude 2021-04-20T19:55:51.293500Z

@wilkerlucio currently the options are: create functions either in :init or in a script and use functional programming... or use (do (shell "bb clean") ...) to invoke a task from within bb. I do want to support this better but I haven't found a satisfying syntax yet

wilkerlucio 2021-04-20T19:56:41.293700Z

I think the options you pointed out are good, not sure if needs any change πŸ‘

wilkerlucio 2021-04-20T19:57:01.293900Z

because more stuff means extended semantics, maybe its a good thing to keep the task semantics simple (only call on depends)

borkdude 2021-04-20T19:58:37.294100Z

yeah sure

wilkerlucio 2021-04-20T20:17:58.295500Z

one any snippet I’m using with babashka tasks:

-$TASK$
{:depends [$DEPS$]}

$TASK$
(shell "bb run --parallel -$TASK$")
(this is using IntelliJ format, but easy to port over to other snippet systems)

1πŸŽ‰
wilkerlucio 2021-04-20T20:18:22.295600Z

I have this is ptask to quickly get it in

2021-04-20T20:50:26.298200Z

I have a bb.edn like this: {:tasks {hello {:requires [[babashka.fs :as fs]] :task (println "hello")}}} that works fine. But if I refactor it like this: {:requires [[babashka.fs :as fs]] :tasks {hello {:task (println "hello")}}}`` it tries to download an updated clojure-tools.jar (and fails due to work’s egress firewall :face_with_rolling_eyes: )

2021-04-20T20:50:50.298700Z

Is there a reason :requires works differently at the top-level than it does within a task?

borkdude 2021-04-20T21:18:43.299Z

@jkrasnay :requires should be within :tasks

borkdude 2021-04-20T21:19:28.299500Z

as in:

{:tasks {:requires ([foo.bar :as baz])}}

2021-04-20T21:20:16.300Z

Oh, I don’t know where I got the idea that it could be at the top level. Thanks!

borkdude 2021-04-20T21:26:03.300300Z

I made the same mistake as well

borkdude 2021-04-20T21:26:22.300700Z

When the format stabilizes I will add linting support in clj-kondo

borkdude 2021-04-20T22:08:36.301600Z

Finally made a bb script/lib to update a github release with artifacts from multiple steps and even from two different CIs: https://github.com/borkdude/gh-release-artifact

borkdude 2021-04-20T22:08:52.302200Z

This will make future releases of clj-kondo and bb less time consuming for me

39πŸŽ‰