Merge branch 'master' into clojure-1.12

This commit is contained in:
Michiel Borkent 2024-09-06 14:18:59 +02:00
commit be90013c5e
12 changed files with 40 additions and 59 deletions

View file

@ -7,6 +7,16 @@ A preview of the next release can be installed from
[Babashka](https://github.com/babashka/babashka): Native, fast starting Clojure interpreter for scripting
## Unreleased
- [#1598](https://github.com/babashka/babashka/issues/1598): use Rosetta on CircleCI to build x64 images
- Bump SCI
- Bump `fs`
- Bump `process`
- Bump `deps.clj`
- Bump `http-client`
- Add `java.io.LineNumberReader`
## 1.3.191 (2024-06-19)
- Fix [#1688](https://github.com/babashka/babashka/issues/1688): `use-fixtures` should add metadata to `*ns*`
@ -19,7 +29,7 @@ A preview of the next release can be installed from
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.core/*source-path*` (points to the same sci var as `*file*`) ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.main/with-read-known` ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.core.server/repl-read` ([@bobisageek](https://github.com/bobisageek))
- #1696: make the `cognitect-labs/transcriptor` library work ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): make the `cognitect-labs/transcriptor` library work ([@bobisageek](https://github.com/bobisageek))
- [#1700](https://github.com/babashka/babashka/issues/1700): catch exceptions from resolving symbolic links during `bb.edn` lookup ([@bobisageek](https://github.com/bobisageek))
- Support `java.nio.channels.ByteChannel` + several other related interop
- Bump `nrepl/bencode` to `1.2.0`

View file

@ -40,10 +40,10 @@ As one user described it:
## Quickstart
For installation options check [Installation](https://github.com/babashka/babashka#installation).
For quick installation use:
For quick installation using `bash`, use:
``` shell
$ bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)
```
or grab a binary from [Github
@ -53,9 +53,12 @@ anywhere on the path.
Then you're ready to go:
``` shellsession
$ ls | bb -i '(filter fs/directory? *input*)'
("doc" "resources" "sci" "script" "src" "target" "test")
bb took 4ms.
time bb -e '(->> (fs/list-dir ".") (filter fs/directory?) (map fs/normalize) (map str) (take 3))'
```
``` clojure
(".build" "feature-lanterna" ".repl")
bb -e 0,01s user 0,01s system 70% cpu 0,017 total
```
## Support :heart:
@ -120,46 +123,6 @@ by Daniel Higginbotham, who has also helped a lot of people learn Clojure with
[Clojure for the Brave and
True](https://www.braveclojure.com/clojure-for-the-brave-and-true/).
## Examples
Read the output from a shell command as a lazy seq of strings:
``` shell
$ ls | bb -i '(take 2 *input*)'
("CHANGES.md" "Dockerfile")
```
Read EDN from stdin and write the result to stdout:
``` shell
$ bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]'
[1 2]
```
Read more about `*input*` and in- and output flags
[here](https://book.babashka.org/#_input_and_output_flags).
Execute a script. E.g. print the current time in California using the
`java.time` API:
File `pst.clj`:
``` clojure
#!/usr/bin/env bb
(def now (java.time.ZonedDateTime/now))
(def LA-timezone (java.time.ZoneId/of "America/Los_Angeles"))
(def LA-time (.withZoneSameInstant now LA-timezone))
(def pattern (java.time.format.DateTimeFormatter/ofPattern "HH:mm"))
(println (.format LA-time pattern))
```
``` shell
$ bb pst.clj
05:17
```
More examples can be found [here](examples/README.md).
## Try online
You can try babashka online with Nextjournal's babashka [notebook

@ -1 +1 @@
Subproject commit aa143f015469884d91f812e16b977ecccdcc2c04
Subproject commit 42dae4007337ca9d31b4df83b652b03de8e09b7b

View file

@ -18,7 +18,7 @@
"deps.clj/src" "deps.clj/resources"
"resources" "sci/resources"
"impl-java/src"],
:deps {org.clojure/clojure {:mvn/version "1.12.0-beta2"},
:deps {org.clojure/clojure {:mvn/version "1.12.0"},
org.babashka/sci {:local/root "sci"}
org.babashka/babashka.impl.java {:mvn/version "0.1.8"}
org.babashka/sci.impl.types {:mvn/version "0.0.2"}
@ -51,7 +51,7 @@
insn/insn {:mvn/version "0.5.2"}
org.clojure/core.rrb-vector {:mvn/version "0.1.2"}
org.babashka/cli {:mvn/version "0.8.59"}
org.babashka/http-client {:mvn/version "0.4.18"}
org.babashka/http-client {:mvn/version "0.4.20"}
org.flatland/ordered {:mvn/version "1.15.12"}}
:aliases {:babashka/dev
{:main-opts ["-m" "babashka.main"]}

2
fs

@ -1 +1 @@
Subproject commit 8658cab4981158dfd439b55b5932a276c4b65bf2
Subproject commit 99d6a3b2f55b851a6949ed6eee31412b299dcf01

View file

@ -21,8 +21,8 @@
:non-flaky (complement :flaky)
:flaky :flaky}
:jvm-opts ["--enable-preview"]
:dependencies [[org.clojure/clojure "1.12.0-beta2"]
[borkdude/edamame "1.4.24"]
:dependencies [[org.clojure/clojure "1.12.0"]
[borkdude/edamame "1.4.27"]
[borkdude/graal.locking "0.0.2"]
[org.clojure/tools.cli "1.0.214"]
[cheshire "5.13.0"]
@ -36,7 +36,7 @@
[rewrite-clj/rewrite-clj "1.1.47"]
[insn/insn "0.5.2"]
[org.babashka/cli "0.8.59"]
[org.babashka/http-client "0.4.18"]]
[org.babashka/http-client "0.4.20"]]
:plugins [[org.kipz/lein-meta-bom "0.1.1"]]
:metabom {:jar-name "metabom.jar"}
:profiles {:feature/xml {:source-paths ["feature-xml"]

View file

@ -51,7 +51,7 @@
insn/insn {:mvn/version "0.5.2"}
org.clojure/core.rrb-vector {:mvn/version "0.1.2"}
org.babashka/cli {:mvn/version "0.8.59"}
org.babashka/http-client {:mvn/version "0.4.18"}
org.babashka/http-client {:mvn/version "0.4.20"}
org.flatland/ordered {:mvn/version "1.15.12"}}
:aliases {:babashka/dev
{:main-opts ["-m" "babashka.main"]}

2
sci

@ -1 +1 @@
Subproject commit 7fb09a7826f7451ed73587888bc909076394b1ba
Subproject commit f766255d14647d46486546dc6afce1ae1bcd2c7b

View file

@ -276,6 +276,7 @@
java.io.FileOutputStream
java.io.FileReader
java.io.FileWriter
java.io.LineNumberReader
java.io.RandomAccessFile
java.io.InputStream
java.io.IOException

View file

@ -14,11 +14,11 @@
edn/read-string)
deps (:deps deps)
deps (assoc deps
'babashka/fs {:mvn/version "0.4.19"}
'babashka/fs {:mvn/version "0.5.22"}
'babashka/babashka.curl {:mvn/version "0.1.2"}
'babashka/babashka.core {:git/url "https://github.com/babashka/babashka.core"
:git/sha "52a6037bd4b632bffffb04394fb4efd0cdab6b1e"}
'babashka/process {:mvn/version "0.5.21"})
'babashka/process {:mvn/version "0.5.22"})
deps (dissoc deps
'borkdude/sci
'org.babashka/sci

View file

@ -1,5 +1,6 @@
(ns httpkit.client-test
(:require [cheshire.core :as json]
[clojure.string :as str]
[clojure.test :refer [deftest is testing #_*report-counters*]]
[org.httpkit.client :as client]))
@ -16,12 +17,14 @@
(deftest get-test
(is (= 200 (:status @(client/get "https://postman-echo.com/get"))))
(is (= "https://postman-echo.com/get"
(is (str/includes?
(-> @(client/get "https://postman-echo.com/get"
{:headers {"Accept" "application/json"}})
:body
(json/parse-string true)
:url)))
:url)
"postman-echo.com/get"))
;; BB-TEST-PATCH: postman started responding with http:// instead of https://
(testing "query params"
(is (= {:foo1 "bar1", :foo2 "bar2"}
(-> @(client/get "https://postman-echo.com/get" {:query-params {"foo1" "bar1" "foo2" "bar2"}})

View file

@ -61,3 +61,7 @@
(is (= :user/success
(bb nil "(try (.createSocket (javax.net.ssl.SSLSocketFactory/getDefault) \"localhost\" 4444) (catch java.net.ConnectException e ::success))")))
(is (bb nil " (.startHandshake (.createSocket (javax.net.ssl.SSLSocketFactory/getDefault) \"clojure.org\" 443)) ::success")))
(deftest jio-line-number-reader-test
(is (= 2 (bb nil "(def rdr (java.io.LineNumberReader. (java.io.StringReader. \"foo\nbar\")))
(binding [*in* rdr] (read-line) (read-line)) (.getLineNumber rdr)"))))