This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-20
Channels
- # ai (1)
- # announcements (4)
- # babashka (61)
- # babashka-sci-dev (14)
- # biff (15)
- # calva (34)
- # clj-kondo (43)
- # clj-on-windows (1)
- # clojure (123)
- # clojure-europe (31)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (4)
- # clojurescript (12)
- # code-reviews (2)
- # community-development (9)
- # core-async (3)
- # datahike (4)
- # datomic (61)
- # events (1)
- # graphql (3)
- # hyperfiddle (155)
- # introduce-yourself (1)
- # lsp (64)
- # malli (10)
- # pathom (10)
- # reagent (5)
- # reitit (6)
- # shadow-cljs (2)
- # tools-build (2)
- # vim (8)
- # xtdb (3)
I am trying to use fs/copy with a wildcard: (fs/copy (str "./" relpath "/lifecycle/*.yml") (str "working/" relpath "/Lifecycle/ansible/scripts/") )
where relpath is a relative path to a directory. I get the error: java.nio.file.NoSuchFileException for the path: ./resources/firstres/0.4/lifecycle/*.yml
. however that path exists and ls with the path works. What am I missing. Also could someone please give an example with the options set. I am confused about what they should look like - I have tried the variations in the API.md file but there are two forms and I am not sure which it should be.
you should first glob the files, and then copy those individually. fs/copy
doesn't support globs
Hi Borkdude, sorry I must be missing something: I get: (fs/copy (fs/glob "." (str relpath "/lifecycle/*.yml")) (str "working/" relpath "/Lifecycle/ansible/scripts/") ) ^--- No implementation of method: :as-file of protocol: #'http://clojure.java.io/Coercions found for class: clojure.lang.PersistentVector
Could you explain the options: I see:
(copy src dest {:keys [:replace-existing :copy-attributes :nofollow-links]})
and
(copy-tree src dest {:keys [:replace-existing :copy-attributes :nofollow-links], :as opts})
but the second caused an error - which is the right one?
(copy src dest {:replace-existing true :copy-attributes true :nofollow-links true})
is how you should call this@borkdude if you have a free minute, could you look at https://github.com/graalvm/mandrel/issues/485 and see if that rings a bell? Babashka built from Mandrel seems to work fine else, not sure why it can't exec however.
Hey @U01FQSYHRCY :)
exec
only works if this is available:
https://github.com/babashka/process/blob/dadcff417675c84dcd32448e22e6270d1555af5d/src/babashka/process.cljc#L559-L563
from a strings
output, I can see that the ProcessProperties stuff is not included in our mandrel bb builds, but they exist in the upstream graalvm builds. But I'm not sure why this is the case.
yes, but if you look at that java code there, mandrel supports exec
i think the question is why bb doesn't pick it up?
@U01FQSYHRCY Perhaps they build the uberjar using non-graal and then compile using graal native image
you should build both the uberjar and the native image using the same Graal JDK preferably
export GRAALVM_HOME=/usr/lib/jvm/mandrel17
lein deps
script/uberjar
script/compile
that's essentially what i do
will try, thx
doesn't make a difference 😕
can I check from the .jar if it's builtin already?
• 72,405 (65.64%) of 110,314 methods reachable + 72,405 (65.63%) of 110,315 methods reachable
clojure.lang.ExceptionInfo: exec is not supported in non-GraalVM environments
if #'process/has-exec?
is false, then it means that already at compile time the process thing wasn't detected
let's see if i can just patch that check out
you can try to run this in a clj REPL with your mandrel JDK:
(def ^:private has-exec?
(boolean (try (.getMethod ^Class
(resolve 'org.graalvm.nativeimage.ProcessProperties) "exec"
(into-array [java.nio.file.Path (Class/forName "[Ljava.lang.String;") java.util.Map]))
(catch Exception _ false))))
but the class is in the graalvm-sdk
-rw-r--r-- 0 0 0 3076 Mar 16 06:42 org/graalvm/nativeimage/ProcessProperties.class
because i couldn't compile graalvm on a musl host
ok, now i fiddled it into the classpath
then it's true
now let's see how to make the build scripts use it
so i think the problem is the uberjar classpath doesn't contain it, then it's disabled, and it doesn't help that native-image would include it because nothing uses it
what happened to the good old days when $CLASSPATH
was simply respected. 😄
/masterdir/builddir/babashka-1.2.174/bb -e '(babashka.process/exec "ls")'
it works!
i hacked it into :resource-paths
80% of things i know about java are from a java 1.1 book my dad had, you know 😉
i'll just patch this locally, no need for you to change things
well same