clojure

hanDerPeder 2025-10-17T08:25:22.779739Z

How can I instantiate nested java records from clojure? say:

public class MyClass {
  public record MyRecord(...)
  public class MyInnerClass(...)
}
`MyClass$MyInnerClass` works, but not MyClass$MyRecord Scratch that, must be a classpath thing. Can get it working with a minimal example

jyn 2025-10-17T03:52:19.401139Z

in case anyone is curious: I did end up getting my CI pipeline working, and it's only moderately cursed https://codeberg.org/jyn514/flower/src/branch/dev/ci/generate_ci.clj

jyn 2025-10-17T10:44:30.796179Z

bb doesn’t support -P without clojure also being installed, so i need clojure anyway and now i have to deal with multiple installs. the caching here is not so complicated but it does have a bootstrapping problem, and bash is actually rather good at process spawning to start with so it didn’t feel so hard to just do that

jyn 2025-10-17T10:45:04.073339Z

note that there needs to be a separate generation step regardless, the CI provider only accepts new jobs through YAML

jyn 2025-10-17T10:46:42.594309Z

i never did find a way to pass arbitrary arguments through the integration test runner :/ that was the hard part, not the shell quoting. but i spent enough time on this already it didn’t seem worth it just to avoid messing with symlinks

borkdude 2025-10-17T10:47:34.344769Z

@jyn514

bb clojure -P
works without clojure installed :)

jyn 2025-10-17T10:47:47.455829Z

oh huhhhh

borkdude 2025-10-17T10:47:49.942549Z

also you can programmatically invoke it from bb itself

jyn 2025-10-17T10:48:00.553279Z

maybe i misread the docs

borkdude 2025-10-17T10:48:03.470379Z

(babashka.tasks/clojure "-P")

jyn 2025-10-17T10:48:05.980719Z

this is quite promising

borkdude 2025-10-17T10:49:02.359959Z

it does download a tools jar in first invocation (that you could cache in CI if you wanted). it's the same tools jar that the clojure CLI would invoke

jyn 2025-10-17T10:50:54.256799Z

@borkdude one other thing that confused me: it has a separate bb.edn, which is fine, but it also warns that it can’t manage java libraries? the thing i need clojure -P and tools.build for is building flower into an uberjar, and i do have native java dependencies

borkdude 2025-10-17T10:51:28.502109Z

"but it also warns that it can’t manage java libraries?"?

borkdude 2025-10-17T10:52:07.035769Z

if you invoke clojure with bb, none of these limitations are there, it's just clojure

borkdude 2025-10-17T10:52:25.423969Z

but maybe I'm misunderstanding you

jyn 2025-10-17T10:52:47.786709Z

oh i see, it’s literally running the clojure jar file it just downloaded

borkdude 2025-10-17T10:52:58.184579Z

yes

jyn 2025-10-17T10:53:01.620329Z

how does that work from inside graal? do you need java installed also?

borkdude 2025-10-17T10:53:13.137559Z

yes. but the clojure CLI also needs that

👍 1
borkdude 2025-10-17T10:53:40.126209Z

bb clojure is using this https://github.com/borkdude/deps.clj it's a rewrite of the clojure CLI bash script that you can programmatically invoke as well

jyn 2025-10-17T10:53:48.587419Z

that’s hot

jyn 2025-10-17T10:54:35.964819Z

i wish it were easier to do caching with literally any CI provider, i found exactly two that would let me load a docker image without needing it pre-published to a registry and they both had other limitations

jyn 2025-10-17T10:54:58.795359Z

https://codeberg.org/jyn514/flower/issues/77

jyn 2025-10-17T10:57:29.444679Z

the current setup is minimizing “setup done after downloading the docker image” which is a really silly thing to have to worry about and ties me to popular tools :/ but the alternative is that i set up a private S3 bucket that i use to store caching layers

borkdude 2025-10-17T06:51:11.432089Z

Why are you generating bash with bb if you can also run bb in CI? :-)