This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-30
Channels
- # announcements (8)
- # babashka (102)
- # beginners (312)
- # calva (9)
- # clj-kondo (9)
- # cljfx (7)
- # clojure (126)
- # clojure-europe (52)
- # clojure-nl (2)
- # clojure-norway (2)
- # clojure-spec (5)
- # clojure-uk (4)
- # clojurescript (13)
- # conjure (5)
- # cursive (5)
- # datalog (18)
- # datomic (8)
- # emacs (1)
- # events (3)
- # fulcro (16)
- # graphql (2)
- # gratitude (1)
- # helix (16)
- # inf-clojure (17)
- # introduce-yourself (9)
- # java (11)
- # lambdaisland (3)
- # leiningen (3)
- # lsp (8)
- # malli (3)
- # membrane (7)
- # missionary (26)
- # nextjournal (1)
- # off-topic (19)
- # pathom (3)
- # polylith (13)
- # portal (16)
- # reagent (39)
- # reitit (2)
- # releases (23)
- # remote-jobs (1)
- # shadow-cljs (40)
- # specter (3)
- # sql (12)
- # tools-deps (8)
- # tree-sitter (1)
- # vim (3)
- # web-security (6)
- # xtdb (16)
A neat babashka script to give an overview of column width in your project: https://twitter.com/ghoseb/status/1509129173683834884
Tomorrow is the last day to complete the babashka survey! Please take it if you're using bb! https://docs.google.com/forms/d/e/1FAIpQLScQ13ZKsXzN594uvzxOTV8juaoETIHDk-T1XBizwe-fVh8Gyw/viewform
I tried to see if clj-chrome-devtools would run with babashka, got
clojure.lang.ExceptionInfo: Could not resolve symbol: monitor-enter
{:type :sci/error, :line nil, :column nil, :file "clojure/spec/gen/alpha.clj", :phase "analysis"}
oh, you should include this dependency for clojure.spec: https://github.com/babashka/spec.alpha/blob/babashka/src/main/clojure/clojure/spec/gen/alpha.clj
but I didn't try to upgrade, the project is using some old libraries anyway... this is coming as a transitive dep
but why does a chrome devtools tool use spec gen alpha at runtime... that seems to be mostly for testing
you can see this with (binding [clojure.core/*loading-verbosely* true] (require '[...])
(in clojure)
yes, it is supported by graalvm compilation, just not as a special form in interpreted SCI code right now
So how I'm testing this: I checked out the project. Then ran:
$ lein classpath > .classpath
and then I ran:
$ bb --classpath $(cat .classpath) -e "(require '[clj-chrome-devtools.core])"
Which resulted in:
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: Unable to resolve classname: org.eclipse.jetty.websocket.client.ClientUpgradeRequest
Location: gniazdo/core.clj:2:3
----- Context ------------------------------------------------------------------
1: (ns gniazdo.core
2: (:import java.net.URI
^--- Unable to resolve classname: org.eclipse.jetty.websocket.client.ClientUpgradeRequest
3: java.nio.ByteBuffer
4: java.util.List
5: (org.eclipse.jetty.websocket.client ClientUpgradeRequest
6: WebSocketClient)
7: (org.eclipse.jetty.util.ssl SslContextFactory)
You could try to replace org.eclipse.jetty.websocket client by the java.net.http
stuff.
Also this library works with bb, if you want to include a dep: https://github.com/schmee/java-http-clj#websockets
got rid of the jetty in favor of java http, that's a good idea in any case to shed some dependencies
❯ bb --classpath $(cat .classpath) -e "(require '[clj-chrome-devtools.core])"
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Protocol not found: java.lang.AutoCloseable
does bb defrecord have some limitations wrt java interfaces?is there a bb specific reader conditional that could be used to omit that? It would be best if the same code worked in jvm clojure and bb
another ns still has problems
bb --classpath $(cat .classpath) -e "(require '[clj-chrome-devtools.automation.launcher])"
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Unable to resolve classname: clojure.lang.Var
Phase: analysis
will investigateok, found the blog post https://blog.michielborkent.nl/using-clojure-spec-alpha-with-babashka.html
got over the spec stuff... next up is core.async... as go
is not supported I think I'll need some bigger changes
the go blocks in use are very simple, maybe I could just rip out core.async as well and use java.util.concurrent stuff instead
you shouldn't really get an error with those, if you're not using millions of go blocks
for some reason I was
Type: clojure.lang.ExceptionInfo
Message: Could not resolve symbol: clj-chrome-devtools.events/go
Phase: analysis
but I already started with replacing core.async use, it will actually be simpler to use promises and an executor service for listeners
I'm pretty sure that I'm an idiot but I can't figure out what is going wrong here (using Java 8, but does not seem to matter)
% bb
1.9.0 src:/Users/alex.miller/.m2/repository/org/clojure/clojure/1.9.0/clojure-1.9.0.jar:/Users/alex.miller/.m2/repository/org/clojure/core.specs.alpha/0.1.24/core.specs.alpha-0.1.24.jar:/Users/alex.miller/.m2/repository/org/clojure/spec.alpha/0.1.143/spec.alpha-0.1.143.jar
clojure.lang.Symbol: private static final long serialVersionUID = 1191039485148212259L;
1.8.0 src:/Users/alex.miller/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar
@U064X3EF3 I've tried your script, but had to delete some weird whitespace symbols, after that it worked for me...
1.9:
clojure.lang.Symbol: private static final long serialVersionUID = 1191039485148212259L;
1.8:
clojure.lang.Symbol: private static final long serialVersionUID = 1191039485148212259L;
Hey. On 0.7.8 bb, I also get a blank. Looks like the last process call is failing. Change that last go line to (println (:err @(process ["serialver" "-classpath" cp c] {:err :string})))
to see Class clojure.lang.Symbol not found.
and then the question is ... why?
0.7.6 Linux here. Prints the src: output for both 1.9.0 and 1.8.0 but no serialVersionUID after 1.8.0
Can you try this?
(require '[babashka.process :refer [process
check]])
(defn go
[clj-ver]
(let [c "clojure.lang.Symbol"
cp (:out (check (process
["clj" "-Spath" "-Sdeps"
(format "{:deps {org.clojure/clojure {:mvn/version \"%s\"}}}" clj-ver)]
{:out :string})))]
(println)
(println clj-ver cp)
(println (:out @(process ["serialver" "-classpath" cp c] {:out :string})))))
(go "1.9.0") ;; works as expected
(go "1.8.0") ;; no output, not sure why
As I said, I had to remove a couple of weird whitespace symbols, perhaps it was that?
does not seem like it, same original output for me
@U04V15CAJ I was only able to repro in a fresh directory. When I ran it in an existing clj project, I got your results. I'm also 0.7.8 osx
Also try:
(println (:out (check (process ["serialver" "-classpath" cp c] {:out :string}))))
for 1.8, then you will see the error output at least. Not sure why this happens yet(require '[babashka.process :refer [process
check]]
'[clojure.string :as str])
(defn go
[clj-ver]
(let [c "clojure.lang.Symbol"
cp (str/trim (:out (check (process
["clj" "-Spath" "-Sdeps"
(format "{:deps {org.clojure/clojure {:mvn/version \"%s\"}}}" clj-ver)]
{:out :string}))))]
(println)
(println clj-ver cp)
(println (:out (check (process ["serialver" "-classpath" cp c] {:out :string}))))))
(go "1.9.0") ;; works as expected
(go "1.8.0") ;; no output, not sure why
I'm getting:
clojure.lang.Symbol: private static final long serialVersionUID = 1191039485148212259L;
clojure.lang.Symbol: private static final long serialVersionUID = 1191039485148212259L;
maybe that's a Clojure CLI question, no idea
yeah, works now for me so that was it, just unclear why it's different
I'm getting the same one?
$ bb -e '(= "1191039485148212259L" "1191039485148212259L")'
true
not talking about that
don't care about the particular answer here at all, this is subset of much larger script
yeah, new line
for me, this failed for all clojure versions through 1.8, worked on 1.9-1.11
I guess that's the spec switchover so more jars so maybe classpath construction is different
I suspect having more deps than only clojure (like clojure.spec) accidentally fixed it
probably something in tools.deps
same version of serialver
I mean, when you feed serialver a classpath with a newline, maybe it behaves sometimes correct, sometimes not
Yeah could be
$ serialver -classpath "src:/Users/borkdude/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar" clojure.lang.Symbol
clojure.lang.Symbol: private static final long serialVersionUID = 1191039485148212259L;
$ serialver -classpath "src:/Users/borkdude/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar\n" clojure.lang.Symbol
Class clojure.lang.Symbol not found.
Another question - can I make serialver a bg process ?
Right now it foregrounds and steals focus
Putting something before newline fixes it:
$ serialver -classpath "src:/Users/borkdude/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar:\n" clojure.lang.Symbol
clojure.lang.Symbol: private static final long serialVersionUID = 1191039485148212259L;
So I guess it was that.
Yes, just don't dereference the process and it runs in the background.I mean, I see a serialver task show up in the task manager and it gets focus, then the process dies and it goes away, for every call (I'm running this in a nested loop over every clojure release and class)
don't I need to deref to get the string output? or should I slurp the stream
which Java?
$ java --version
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)
ah, does it on 1.8, but not on newer
I switched as I was debugging
It is. E.g. this is the build step in one of my .gitlab-ci.yml configs that builds a webapp with shadow-cljs and then runs a bb script that reads the manifest.edn output from shadow and points the index.html to the correct js file:
build:webapp:
stage: build:webapp
image: clojure:latest
tags:
- docker-runner
artifacts:
paths:
- public/
script:
- apt-get update && apt-get -y install nodejs npm curl unzip
- npm install
- npx shadow-cljs release app
- bash < <(curl -s )
- bb update-index.clj