This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-02
Channels
- # announcements (7)
- # aws (3)
- # babashka (132)
- # beginners (38)
- # calva (3)
- # chlorine-clover (6)
- # clara (1)
- # clj-kondo (20)
- # cljs-dev (24)
- # cljsrn (9)
- # clojure (76)
- # clojure-dev (1)
- # clojure-germany (4)
- # clojure-india (2)
- # clojure-uk (24)
- # clojurescript (15)
- # conf-proposals (1)
- # conjure (114)
- # cursive (3)
- # fulcro (63)
- # graalvm (1)
- # helix (2)
- # joker (10)
- # juxt (1)
- # local-first-clojure (2)
- # meander (9)
- # off-topic (97)
- # rdf (4)
- # re-frame (7)
- # reagent (16)
- # reitit (1)
- # rum (9)
- # shadow-cljs (48)
- # spacemacs (3)
- # tools-deps (3)
- # vim (30)
- # xtdb (10)
FYI: This is a tiny multithreaded web server that I wrote. It has a tiny router and uses bootstrap. https://github.com/bherrmann7/bb-common/blob/master/wee_httpd.bb I started with the existing "single threaded" example web server, and added on to it.
@borkdude looks like script/compile changed recently to use: set -eou pipefail
instead of set -eo pipefail
i am not having luck running the compile script with that change. removing the u
seems to help.
may be there is something else i should do instead?
@sogaiu yeah, I added -u
to prevent silly mistakes on my end. what's the error you get
hm, I was trying to add java.lang.Character
to bb, so I could use https://github.com/joegallo/doric, which fails with:
clojure.lang.ExceptionInfo: Could not resolve symbol: Character/toTitleCase [at doric/core.clj, line 8, column 11]
Neh, it's just missing here I think: https://github.com/borkdude/babashka/blob/master/src/babashka/impl/classes.clj
$ ./bb
Babashka v0.0.91-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (java.lang.Character/isDigit \4)
true
user=> (java.lang.Character/toTitleCase \t)
\T
but the code in doric looks like this:
(defn- title-case-word [w]
(if (zero? (count w))
w
(str (Character/toTitleCase (first w))
(subs w 1))))
it's like resolve, but it also takes an ns right?
user=> (ns-resolve 'clojure.set 'join)
Execution error at user/eval138 (REPL:1).
No namespace: clojure.set found
user=> (require '[clojure.set])
nil
user=> (ns-resolve 'clojure.set 'join)
#'clojure.set/join
@U0510902N Simple workaround for now:
$ bb -e "(ns clojure.core) (defn ns-resolve [ns sym] (resolve (symbol (str ns) (str sym))))" -e "(ns-resolve 'clojure.string 'join)"
#'str/join
I think in clojure 1.10 you would use requiring-resolve
for this. I'll also add that
Weeeird. When this code is loaded from a library:
(defn columns1 [cols]
(doall(for
[col cols]
col)))
(defn table
[cols]
(doall (for [col cols] col)))
and then you call (table nil)
, you get:
clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Boolean [at line 155, column 3]
I also can't reproduce it when I paste that code in a file and load it with load-file, but when I load that library code with load-file, the error is there, so it seems to be specific to that file...
Repro:
(ns doric.core
(:refer-clojure :exclude [when]))
(defn when [col & [data]]
(:when col true))
(defn columns1 [cols]
(doall(for
[col cols]
col)))
(defn table
[cols]
(doall (for [col cols] col)))
(table nil)
$ clj -A:bb-local -cp /tmp/doric/src -e "(use '[doric.core])" -e "(println (table [:a :b] [{:a 1 :b 2}]))"
|---+---|
| A | B |
|---+---|
| 1 | 2 |
|---+---|
$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {doric {:mvn/version "0.9.0"}}}')
$ ./bb -e "(use '[doric.core])" -e "(println (table [:a :b] [{:a 1 :b 2}]))"
|---+---|
| A | B |
|---+---|
| 1 | 2 |
|---+---|
😄for some libraries I've just downloaded their test suite into test-resources/lib_tests
I'm working on it already - I think it's good to discover more things to make bb compatible with libs like this
Alrighty, doric tests are now part of babashka CI smoke tests: https://github.com/borkdude/babashka/commit/54a4197ce73dc16abf7eea9bbea7a11c49ea29b3
I also tried this guy's fork, for which there is a PR:
https://github.com/jgdavey/doric
But that PR breaks bb compatibility because of defprotocol
. I hope I have some time soon, to see what can be done about that. It seems to be the most incompatible thing at the moment
thanks to your update, my little path manipulation script can show a path in a nicer way than usual:
$ ./scripts/empath $(clojure -Spath)
|-------------------------------------------------------------------------------------------+--------+-------+-------+-----------|
| Element | Exists | Dir | File | Can Write |
|-------------------------------------------------------------------------------------------+--------+-------+-------+-----------|
| src | true | true | false | true |
| /home/nate/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar | true | false | true | true |
| /home/nate/.m2/repository/comb/comb/0.1.1/comb-0.1.1.jar | true | false | true | true |
| /home/nate/.m2/repository/doric/doric/0.9.0/doric-0.9.0.jar | true | false | true | true |
| /home/nate/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar | true | false | true | true |
| /home/nate/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar | true | false | true | true |
|-------------------------------------------------------------------------------------------+--------+-------+-------+-----------|
I'll make a new release, so you can show off this nice script to the rest of the world 😉
Hi all. I tried to add the oracle jdbc driver to bb 0.90 by adding a new profile (in the same vein as the postgres and hsqldb already are) which contains the oracle jdbc driver jar. I have verified that the uberjar contains the driver and the build succeeds, but on trying to use the jar I get the following exception. The class oracle.jdbc.driver.T4CDriverExtension
is in the uberjar. Any ideas on what’s going on or how to get past this much appreciated.
Maybe it needs reflective access to that class. You can discover this by running with a GraalVM agent
thanks for the pointer, I remember messing (think I even did a PR) with that file before. Ok I will at a minimum try to add the class it is complaining about and rebuild and see where that leaves me
you can run with lein bb
instead of bb to just test before you with the image, just to see if there's nothing else broken
yeah I have an issue where I need to build the uberjar on one system and do the graal compile on another (c dependencies on production servers differ and no access to lein there)
well, there is a separate script/uberjar and script/compile now, so that works I guess
and since I’m here, thanks for those graal build scripts, they have helped me in getting a few other projects built.
I did:
java.util.zip.GZIPOutputStream
oracle.jdbc.driver.T4CDriverExtension
~(symbol "[B")
to no avail, ok will google itwell I can’t run lein on the target machine an I can’t run the native version of bb produced on the machine where lein works, would that scenario not invalidate the lein bb
idea?
I found a graal ticket discussing the oracle driver, working through that now, we’ll see if I can get it working
if yes, I can make some kind of pr, I suspect we can not check in the oracle driver as oracle is what they is, but I could set everything aside from the driver up so that other people who need this can just enable the feature and drop in the jar
well on maven central there is a reference to another repository where you get a 404
and going to oracle you can get to a maven repository but you need an oracle account to use it which I’m sure involves agreeing to som draconian eula involving your first born child, the fires of hell, brimstone etc
ah and it also depends on the driver version you need, could be the later versions actually exist in some repo
maybe add instructions how people can add these drivers to the classpath then, while building the uberjar
I’ll work through this, if I get out on the other side with something useful I will ping that as a PR or here
figured I could create an md page for oracle explaining the process, assuming I can actually get this to work
I have some docs for hypersql and postgres here: https://github.com/borkdude/babashka/blob/master/doc/build.md#hypersql Could add Oracle to that page