Fork me on GitHub
#babashka
<
2022-01-12
>
borkdude12:01:44

The #etaoin babashka pod has an update (last update was August 2021): It allows you to use etaoin from babashka scripts. Other than writing UI tests, I also use it together with a file-watcher to refresh the browser while I'm writing docs (see https://github.com/babashka/book/blob/master/script/watch.clj). • Add `wait` in `pod.babashka.etaoin` https://github.com/babashka/pod-babashka-etaoin/issues/11 (https://github.com/mprokopov) • Upgrade to etaoin 0.4.6 • Add `pod.babashka.etaoin.query/expand` https://github.com/babashka/pod-babashka-etaoin/issues/10 See https://github.com/babashka/pod-babashka-etaoin#run how to use it.

🙌 2
pinkfrog12:01:14

I’d like to access Flyway with bb, however, running bb it fails with

Unable to resolve classname: org.flywaydb.core.Flyway

borkdude12:01:10

You can only access pre-defined classes in bb, so that's not going to work. Options: 1. Shell out the flyway CLI from bb. 2. Build a flyway pod. 3. Or just use clojure on the JVM.

pinkfrog12:01:33

On a second thought, I will go with 1 to shell out flyway cli from bb.

pinkfrog12:01:54

What do you mean by pre-defined? bb.edn supports adding new jars, so how the classes are predefined?

borkdude12:01:50

Only pre-compiled classes from this file: https://github.com/babashka/babashka/blob/master/src/babashka/impl/classes.clj are available in bb.

pinkfrog13:01:55

Given that, what’s the purpose of adding jar dependencies?

borkdude13:01:43

The jars contain clojure sources which bb can (often) execute

borkdude13:01:29

See here for a selection of libraries that work with bb: https://github.com/babashka/babashka/blob/master/doc/projects.md Usually when a library uses pure Clojure and no strange optimizations or third party Java libs, it works, except when it uses deftype which is not supported in bb.

pinkfrog13:01:48

Thanks for the detailed info!

pinkfrog01:01:59

I am now going with this approach: 1. Write a file, e.g., ctl.cj as the entrance of all commands 2. Inside ctl.cj, if some command require java class, then use b/process to invoke clojure -X some/command

pinkfrog01:01:34

This works rather fast though. I guess might because the some/command namespace has little class to load at the starting time.

borkdude07:01:26

Yeah cool that works. You can also use babashka.tasks/clojure for this

Joey Bloom20:01:30

Is there a way to use deps.edn aliases with bb? I tried setting up my project this way: bb.edn:

{:paths ["src"]
 :deps {org.babashka/spec.alpha {:git/url ""
                                 :git/sha "644a7fc216e43d5da87b07471b0f87d874107d1a"}}
 :aliases
 {:test {:extra-paths ["test"]}}}
I'd like to be able to build an uberscript with just src on the classpath, e.g.
bb --uberscript uberscript -m my-project.core
Then I'd like to run unit tests with both src and test . The following doesn't actually work, but it's what I have in mind:
bb -A:test -m my-project.test-runner

borkdude20:01:03

@15joeybloom You can use {:tasks {test {:extra-paths ["test"} :task my-project.test-runner}} and then invoke bb test to run the tests

Joey Bloom20:01:57

Thanks, this is exactly what I need! Got this error message with :task my-project.test-runner:

bb test
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Could not resolve symbol: my-project.test-runner
Location: <expr>:23:1
Phase:    analysis

----- Context ------------------------------------------------------------------
19: nil
20: (def test (binding [
21:   babashka.tasks/*task* '{:name test, :extra-paths ["test"], :task my-project.test-runner}]
22:   nil
23: my-project.test-runner)) test
    ^--- Could not resolve symbol: my-project.test-runner
I explicitly specified the main function name ( :task my-project.test-runner/-main ) and it worked.

Joey Bloom20:01:57

Thanks, this is exactly what I need! Got this error message with :task my-project.test-runner:

bb test
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Could not resolve symbol: my-project.test-runner
Location: <expr>:23:1
Phase:    analysis

----- Context ------------------------------------------------------------------
19: nil
20: (def test (binding [
21:   babashka.tasks/*task* '{:name test, :extra-paths ["test"], :task my-project.test-runner}]
22:   nil
23: my-project.test-runner)) test
    ^--- Could not resolve symbol: my-project.test-runner
I explicitly specified the main function name ( :task my-project.test-runner/-main ) and it worked.

borkdude20:01:46

we should probably fix that glitch, issue welcome

vadyalex23:01:46

I tried to run bb binary on Raspbian to understand I have 32-bit Raspbian but bb for Linux ARM is 64-bit version, is that correct?

vadyalex23:01:28

I assume it's unnecessary additional burden into release pipeline to compile bb binary for Linux ARM 32-bit.

borkdude23:01:22

that's not possible due to no support from graalvm for it

vadyalex23:01:33

Would I be better off trying to run bb via jar file on JVM?

borkdude23:01:12

you can do it but it will be pretty slow. you can better use normal Clojure + the libraries in babashka