Fork me on GitHub
#babashka
<
2021-08-22
>
tatut09:08:27

this is probably nothing novel, but I was pleasantly surprised how good a match babashka and aws lambda custom runtimes are... https://github.com/tatut/bb-lambda

👍 8
ericdallo13:08:43

ATM babashka graalvm config is manually passed during the script/compile, do you see any issue migrate it to classpath/META-INF/native-image/babashka/babashka/... ? 🧵

ericdallo13:08:35

I made this on clojure-lsp and this have some advantages like

ericdallo13:08:37

most of the graalvm config can be moved to the native-image.properties , so it's harder to get outdated downstreams like nixpkgs: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/clojure/babashka.nix#L30-L67 which mnually set all graalvm configs

borkdude13:08:04

yeah, I'm open to that change

ericdallo13:08:10

this also works for other configurations like reflrection-config.json and jni

ericdallo13:08:26

cool, I can try that and open a PR 🙂

ericdallo14:08:08

hum, the reflection.json is not static file, right? it's auto generated

ericdallo14:08:29

so I think we can't put into the jar, keep it only the reflection config flag on the script?

borkdude14:08:31

it is part of every release though

ericdallo14:08:01

so could it be possible to add to the jar, right?

ericdallo14:08:35

to add to META-INF/native-image/babashka/babashka/reflect-config.json

ericdallo14:08:44

then graal would pick it up without any extra config

borkdude14:08:54

we could do that during the build process yes

ericdallo14:08:05

alright, I'll check how babashka do that

borkdude14:08:22

I think it's part of the compile script

ericdallo14:08:53

yes it is:

lein with-profiles +reflection,+native-image "do" run

ericdallo14:08:58

the reflection profile

ericdallo14:08:19

Doesn't babashka has any jni or proxy extra config for graalvm?

ericdallo14:08:24

good, compiling and check if everything is working

donavan14:08:09

Are there any known issues with private maven repos hosted in S3 being used in a bb dep? I have a repo that contains a private Maven dep such as: https://github.com/Jordan-River-Advisors/repo-containing-private-s3-maven-dep and I have another repo that uses it as a bb dep like: https://github.com/Jordan-River-Advisors/bb-maven-deps-repro In the project I can download and use the private dep

~/src/repo-containing-private-s3-maven-dep
❯ clj
Clojure 1.10.3
user=> (require '[datomic.ion.dev :as ion])
nil
user=> (ion/deploy)
Execution error (ArityException) at user/eval1574 (REPL:1).
Wrong number of args (0) passed to: datomic.ion.dev/deploy
user=>
I can even download it directly using the s3 cli
~/src/bb-maven-deps-repro
❯ aws s3 cp  /tmp
download:  to ../../../../tmp/ion-dev-0.9.290.jar
~/src/bb-maven-deps-repro
❯
But when I use that project as a git dependency in another project’s bb.edn I get an error, indicating that
~/src/bb-maven-deps-repro
❯ bb --debug test
Cloning: [email protected]:Jordan-River-Advisors/repo-containing-private-s3-maven-dep.git
Checking out: [email protected]:Jordan-River-Advisors/repo-containing-private-s3-maven-dep.git at 734c2547eea8c391b70ecda07fc025eadf9bf4f2
Error building classpath. Could not find artifact com.datomic:ion-dev:jar:0.9.290 in central ()

borkdude14:08:22

Can you try your dep with deps.edn directly to check if it works there? bb uses the same kind of logic to resolve deps as deps.edn

donavan14:08:33

It works directly. I meant to imply given the first shell output above. If I’m in the project with the private repo it downloads the private dep without issue.

repo-containing-private-s3-maven-dep on  main
❯ trash ~/.m2/repository/com/datomic/ion-dev
repo-containing-private-s3-maven-dep on  main
❯ clj
Picked up JAVA_TOOL_OPTIONS:  -XX:-OmitStackTraceInFastThrow -Dapple.awt.UIElement=true -Xms512m -Xmx4g
Downloading: com/datomic/ion-dev/0.9.290/ion-dev-0.9.290.pom from datomic-cloud
Downloading: com/datomic/ion-dev/0.9.290/ion-dev-0.9.290.jar from datomic-cloud
Picked up JAVA_TOOL_OPTIONS:  -XX:-OmitStackTraceInFastThrow -Dapple.awt.UIElement=true -Xms512m -Xmx4g
Clojure 1.10.3
user=>
Where in the bb src does it do the dep resolution?

borkdude14:08:14

babashka.impl.deps

borkdude15:08:28

what I was suggesting is to make a repro using deps.edn only and show that your setup works there, I wasn't referring to "in" or "directly" but to deps.edn vs bb.edn

borkdude15:08:47

so deps.edn lib + deps.edn usage of lib

borkdude15:08:55

using Clojure, not bb

borkdude15:08:13

I think the deps.edn where you are using your lib should have the private repo info in it

borkdude15:08:20

same for bb.edn

donavan16:08:16

Ah, I get you. You are correct, it’s my misunderstanding again of deps, clj, etc…. It works if add the private maven coordinates into bb.edn