This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-08
Channels
- # alda (1)
- # announcements (18)
- # babashka (101)
- # beginners (110)
- # calva (17)
- # cider (53)
- # clara (18)
- # clj-kondo (26)
- # cljdoc (6)
- # clojure (152)
- # clojure-europe (9)
- # clojure-portugal (4)
- # clojure-spec (20)
- # clojure-survey (7)
- # clojure-sweden (10)
- # clojure-uk (10)
- # clojured (1)
- # clojurescript (29)
- # core-async (7)
- # cursive (4)
- # datomic (11)
- # defnpodcast (2)
- # dirac (1)
- # emacs (13)
- # events (2)
- # figwheel-main (1)
- # fulcro (1)
- # jobs (14)
- # jobs-discuss (17)
- # leiningen (2)
- # malli (1)
- # off-topic (74)
- # overtone (1)
- # pedestal (4)
- # planck (2)
- # re-frame (7)
- # reitit (4)
- # remote-jobs (4)
- # shadow-cljs (78)
- # slack-help (3)
- # spacemacs (56)
- # test-check (3)
- # tools-deps (6)
Now removed the reliance on any private sun or Unix-specific class by applying a trick: https://github.com/borkdude/babashka/blob/2b0cb6fb1cf2f86a9bdf22dd6b954a35ec1be21f/src/babashka/impl/classes.clj#L178 Reflection happens on the public class and that seems to work
@UG1C3AD5Z I upgraded the jdk 11 branch. It fails on CI with an out of memory error. https://circleci.com/gh/borkdude/babashka/3364
Updated the issue here: https://github.com/borkdude/babashka/issues/120
this is the jdk11 branch, right? seems to have worked here :thumbsup: got to hear my fans spin up
may be you saw that https://github.com/oracle/graal/issues/2015#event-2928406659 was labeled as a bug within the last day?
Curious about this line in the rationale of deps.clj
:
> This offers an arguably easier way to get going with deps.edn based projects in CI. Just download an installer script, execute it with bash or Powershell and you’re set. Installer scripts are provided for linux, macOS and Windows.
Isn’t that essentially the same installation process as tools.deps?
First successful linux build of babashka on JDK11. Binary for the grabbing in #babashka_circleci_builds !
Is there a way to retrieve the path from the code of the current file that is being executed? E.g. in bb src/path/foo.bb
I would like to get the value src/path/foo.bb
somehow
Is this on purpose?
user=> (.getName *ns*)
Method getName on class sci.impl.vars.SciNamespace not allowed! [at line , column ]
This gives me what I want as well (str *ns*)
yes! thanks 🙂
@jeroenvandijk You can use *file*
for that
Cool, thanks!
In case you are interested, I'm trying to build a script in babashka that can delegate to clojure when needed:
(defn handle-in-clj [msg cli-args]
(println msg)
;; TODO stream output with ProcessBuilder instead
#_(def ws (-> (ProcessBuilder. (into ["clj"] args)) (.start)))
(let [cmd (into ["clj" *file*] (map str) cli-args)
; _ (prn "CMD" cmd)
p (apply clojure.java.shell/sh cmd)]
(exit (:exit p)
(if (zero? (:exit p))
(:out p)
(if (clojure.string/blank? (:err p))
(:out p)
(:err p))))))
(defmacro delegate-to-clj [& body]
#?(:bb `(handle-in-clj "Delegating to clj" *args*)
:clj `(do
[email protected])))
For simple scripts you have the benefit of minimal boot time. For things that require clojure you can already do some input validation before starting the heavy process and saving you time in case of errors. All without having to think about it 😎
That's the idea anyway :)
@jeroenvandijk Take a look at the deps.clj script, it shows how to stream out and err
https://github.com/borkdude/deps.clj/blob/294e389323039f26a10f528867b5fa237e7cd508/deps.clj#L16
Thank you! I'll have a look
Works in Babashka! Funilly enough the JVM doesn't recognize ProcessBuilder$Redirect/INHERIT
It is able to run (ProcessBuilder$Redirect/INHERIT)
, but that doesn't work in Babashka
Can you make a repro of an isolated piece of code that runs with bb but not with clojure?
@U04V15CAJ ah sorry, I made a mistake. Everything does work. Sorry to bother
spartan.test, a test lib that can be used with bb, now has testing
, thrown?
and thrown-with-msg?
:
https://github.com/borkdude/spartan.test
Some progress made on adding clojure.data.xml. Feel free to read+test: https://github.com/borkdude/babashka/issues/153
Seems it also works with 11.0.5:
[email protected]:/tmp$ ./bb
Babashka v0.0.61-SNAPSHOT REPL.
user=> (require '[clojure.data.xml :as xml])
nil
user=> (let [xml (xml/parse-str "<items><item>1</item><item>2</item></items>")] (xml/emit-str xml))
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><items><item>1</item><item>2</item></items>"
user=> (System/getProperty "java.version")
"11.0.5"
I'm always a bit wary of making choices of what should go into babashka. E.g. should I have added clojure.data.json instead of cheshire.core since I already have the other clojure.* stuff? Should I remove core.async because nobody is using it? What will happen to the binary size in the long run?
I'm not sure how much binary size matters to people. Does only the download size matter, or also the extracted size? What's still acceptable?
Anyway. Adding clojure.data.xml seems like a good idea, but I'd like to hear if it's not 🙂
We already have https://github.com/retrogradeorbit/bootleg
the only way to make that work currently is to let users enable the libraries via some UI and circleci will build it
and if someone already has chosen the exact combination of libs before, you will just get the already compiled version immediately
yeah, I don't think that's going to work. I think it has to be curated manually somehow
there could be a branch where people could PR their new favorite library bindings and some config so this UI knows how to enable it
but if people really want their personal libs in bb, they might as well just fork it
if we finally release an api for http://nextjournal.com notebooks we could build it there
@mkvlr what memory / CPU / resource restrictions do you have in nextjournal for free / OSS use?
@mkvlr in babashka.main.clj there is a map which determines which namespaces are included. dissoc-ing that map would already have an effect of which libs are left out
I think graalvm is clever enough to see that it should leave out the libs from the compiled artifact if you dissoc them
but in the end I would do this via some edn config file probably that is read at build time
ok, so we want to allow to pass in the whole map via edn or how do you envision the api?
Syntax error (ClassNotFoundException) compiling at (babashka/impl/classes.clj:188:16).
java.lang.UNIXProcess$ProcessPipeOutputStream
there is no mention anymore of UnixProcess classes, removed that today, so I can't explain that error. Can you show the git sha?
Execution error (FileNotFoundException) at babashka.impl.clojure.core.server/loading (server.clj:12).
Could not locate sci/core__init.class, sci/core.clj or sci/core.cljc on classpath.
ah you need to check out recursively. https://github.com/borkdude/babashka/blob/master/doc/dev.md
Works in Babashka! Funilly enough the JVM doesn't recognize ProcessBuilder$Redirect/INHERIT
It is able to run (ProcessBuilder$Redirect/INHERIT)
, but that doesn't work in Babashka