Merge branch 'master' into tools-analyzer

This commit is contained in:
Michiel Borkent 2022-12-25 12:25:34 +01:00
commit 9eaeb9a193
18 changed files with 72 additions and 28 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
- Implement `ns`, `lazy-seq` as macro
- Support `--dev-build` flag in installation script
- [#1451](https://github.com/babashka/babashka/issues/1451): Allow passing explicit file and line number to clojure.test ([@matthewdowney](https://github.com/matthewdowney))
- [#1280](https://github.com/babashka/babashka/issues/1280): babashka REPL doesn't quit right after Ctrl-d ([@formerly-a-trickster](https://github.com/formerly-a-trickster) and Alice Margatroid)
- [#1446](https://github.com/babashka/babashka/issues/1446): add `pprint/code-dispatch`
- Update zlib to version `1.2.13` ([@thiagokokada](https://github.com/thiagokokada))
- [#1454](https://github.com/babashka/babashka/issues/1454): Add `babashka.process` to `print-deps` output
## 1.0.168 (2022-12-07)
- `loop*`, `fn*` are now special forms and `loop`, `fn`, `defn`, `defmacro`, `and` and `or` are implemented as macros. This restores compatibility with [rcf](https://github.com/borkdude/hyperfiddle-rcf)

View file

@ -7,8 +7,9 @@ WORKDIR "/opt"
ENV GRAALVM_VERSION="22.3.0"
ARG TARGETARCH
ENV BABASHKA_ARCH=${TARGETARCH}
ENV GRAALVM_ARCH=${TARGETARCH}
# Do not set those directly, use TARGETARCH instead
ENV BABASHKA_ARCH=
ENV GRAALVM_ARCH=
RUN if [ "${TARGETARCH}" = "" ] || [ "${TARGETARCH}" = "amd64" ]; then \
export GRAALVM_ARCH=amd64; export BABASHKA_ARCH=x86_64; \
elif [ "${TARGETARCH}" = "arm64" ]; then \

View file

@ -53,7 +53,7 @@ anywhere on the path.
Then you're ready to go:
``` shellsession
$ ls | bb -i '(filter #(-> % io/file .isDirectory) *input*)'
$ ls | bb -i '(filter fs/directory? *input*)'
("doc" "resources" "sci" "script" "src" "target" "test")
bb took 4ms.
```
@ -109,7 +109,8 @@ $ bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]'
[1 2]
```
Read more about input and output flags [here](https://book.babashka.org/#_input_and_output_flags).
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:
@ -174,6 +175,12 @@ Upgrade:
You can find more documentation on how to use babashka with nix [here](./doc/nix.md).
### Alpine
On Alpine it's recommended to download the binary manually from [Github
Releases](https://github.com/babashka/babashka/releases) and use the static
linux binary.
### Arch (Linux)
`babashka` is [available](https://aur.archlinux.org/packages/babashka-bin/) in the [Arch User Repository](https://aur.archlinux.org). It can be installed using your favorite [AUR](https://aur.archlinux.org) helper such as
@ -224,7 +231,7 @@ $ ./install --static
### Installer script
Install via the installer script:
Install via the installer script for linux and macOS:
``` shell
$ curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
@ -399,6 +406,8 @@ handling of SIGINT and SIGPIPE. This can be done by setting
## Articles, podcasts and videos
- [Babashka: How GraalVM Helped Create a Fast-Starting Scripting Environment for Clojure](https://medium.com/graalvm/babashka-how-graalvm-helped-create-a-fast-starting-scripting-environment-for-clojure-b0fcc38b0746) by Michiel Borkent
- [Adding Prompts To Your Babashka Scripts With Dialog](https://www.pixelated-noise.com/blog/2022/12/09/dialog-and-babashka/index.html) by A.C. Danvers
- [Using Babashka to Get Electricity Prices](https://www.karimarttila.fi/clojure/2022/12/04/using-babashka-to-get-electricity-prices.html) by Kari Marttila
- [Manage git hooks with babashka tasks](https://blaster.ai/blog/posts/manage-git-hooks-w-babashka.html) by Mykhaylo Bilyanskyy
- [Messing around with babashka](https://ian-muge.medium.com/messing-around-with-babashka-f181a9003faa) by Ian Muge

@ -1 +1 @@
Subproject commit a195e410bfd61b3befcab40915cf6c2e54b0b7ca
Subproject commit 2d185718ba2871c96e6cb4a4181d1dcf9d8fde86

View file

@ -50,7 +50,7 @@
org.clojure/data.priority-map {:mvn/version "1.1.0"}
insn/insn {:mvn/version "0.5.2"}
org.clojure/core.rrb-vector {:mvn/version "0.1.2"}
org.babashka/cli {:mvn/version "0.5.40"}}
org.babashka/cli {:mvn/version "0.6.41"}}
:aliases {:babashka/dev
{:main-opts ["-m" "babashka.main"]}
:profile

2
fs

@ -1 +1 @@
Subproject commit 965ca67eb1b1ef26c412fa494ce31268fd456c8e
Subproject commit d3226cccd9898eba5adb50dfcc30a7223ff5c8cc

16
install
View file

@ -8,6 +8,7 @@ static_binary="false"
default_install_dir="/usr/local/bin"
install_dir="$default_install_dir"
download_dir=""
dev_build=""
print_help() {
echo "Installs latest (or specific) version of babashka. Installation directory defaults to /usr/local/bin."
@ -56,6 +57,10 @@ do
static_binary="true"
shift
;;
--dev-build)
dev_build="true"
shift
;;
*) # unknown option
print_help
shift
@ -74,8 +79,12 @@ if [[ "$checksum" != "" ]] && [[ "$version" == "" ]]; then
fi
if [[ "$version" == "" ]]; then
if [[ "$dev_build" == "true" ]]; then
version="$(curl -sL https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_VERSION)"
else
version="$(curl -sL https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_RELEASED_VERSION)"
fi
fi
case "$(uname -s)" in
Linux*) platform=linux;;
@ -94,7 +103,12 @@ case "$(uname -m)" in
arch="aarch64"
fi
;;
*) arch=amd64;;
*) arch=amd64
# always use static image on linux
if [[ "$platform" == "linux" ]]; then
static_binary="true"
fi
;;
esac
if [[ 10#$vernum -le 10#000002013 ]]; then

@ -1 +1 @@
Subproject commit 9e19562e108381be7bced275a9065dc182ec1c62
Subproject commit 90e4cf0b0cc7856f8c39591c3350cdf156d11042

View file

@ -32,7 +32,7 @@
[com.github.clj-easy/graal-build-time "0.1.0"]
[rewrite-clj/rewrite-clj "1.1.45"]
[insn/insn "0.5.2"]
[org.babashka/cli "0.5.40"]]
[org.babashka/cli "0.6.41"]]
:plugins [[org.kipz/lein-meta-bom "0.1.1"]]
:metabom {:jar-name "metabom.jar"}
:profiles {:feature/xml {:source-paths ["feature-xml"]

View file

@ -50,7 +50,7 @@
org.clojure/data.priority-map {:mvn/version "1.1.0"}
insn/insn {:mvn/version "0.5.2"}
org.clojure/core.rrb-vector {:mvn/version "0.1.2"}
org.babashka/cli {:mvn/version "0.5.40"}}
org.babashka/cli {:mvn/version "0.6.41"}}
:aliases {:babashka/dev
{:main-opts ["-m" "babashka.main"]}
:profile

2
sci

@ -1 +1 @@
Subproject commit 62a16eb620bb6e8ae072f9f17baa3de5546f0902
Subproject commit 92a071269f1a4e3f4fda262b33b47ec827be3d4e

View file

@ -19,8 +19,8 @@ fi
apt-get update -y && apt-get install musl-tools -y
ZLIB_VERSION="1.2.11"
ZLIB_SHA256="c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1"
ZLIB_VERSION="1.2.13"
ZLIB_SHA256="b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30"
# stable archive path
curl -O -sL --fail --show-error "https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz"

View file

@ -120,7 +120,8 @@
clojure.lang.APersistentVector
{:methods [{:name "indexOf"}]}
clojure.lang.LazySeq
{:methods [{:name "indexOf"}]}
{:allPublicConstructors true,
:methods [{:name "indexOf"}]}
clojure.lang.ILookup
{:methods [{:name "valAt"}]}
clojure.lang.IPersistentMap

View file

@ -297,7 +297,7 @@
current assertion."
{:added "1.1"}
[m]
(let [{:keys [:file :line]} (meta (first @testing-vars))]
(let [{:keys [:file :line]} (merge m (meta (first @testing-vars)))]
(str
;; Uncomment to include namespace in failure report:
;;(ns-name (:ns (meta (first *testing-vars*)))) "/ "

View file

@ -208,6 +208,7 @@
'init-navigator (sci/copy-var pprint/init-navigator pprint-ns)
'execute-format (sci/copy-var execute-format pprint-ns)
'with-pprint-dispatch (sci/copy-var pprint/with-pprint-dispatch pprint-ns)
'code-dispatch (sci/copy-var pprint/code-dispatch pprint-ns)
'*print-pprint-dispatch* print-pprint-dispatch
'*print-miser-width* print-miser-width
'get-pretty-writer (sci/copy-var get-pretty-writer pprint-ns)

View file

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

View file

@ -63,13 +63,14 @@
(eval-form sci-ctx `(apply require (quote ~m/repl-requires)))))
:read (or read
(fn [_request-prompt request-exit]
(if (nil? (r/peek-char in))
request-exit
(let [v (parser/parse-next sci-ctx in)]
(skip-if-eol in)
(if (or (identical? :repl/quit v)
(identical? :repl/exit v)
(identical? parser/eof v))
(identical? :repl/exit v))
request-exit
v))))
v)))))
:eval (or eval
(fn [expr]
(sci/with-bindings {sci/file "<repl>"

View file

@ -112,3 +112,9 @@
(deftest line-number-test
(is (str/includes? (bb "test-resources/line_number_test_test.clj")
"line_number_test_test.clj:4")))
(deftest testing-vars-str-test
(is (str/includes?
(bb "(clojure.test/testing-vars-str {:file \"x\" :line 1})")
"() (x:1)")
"includes explicit line number + file name in test report"))