You need lein for running JVM tests and/or producing uberjars. For building binaries you need GraalVM. Currently we use java11-20.2.0.
To work on Babashka itself make sure Git submodules are checked out.
$ git clone https://github.com/borkdude/babashka --recursive
To update later on:
$ git submodule update --recursive
lein repl
will get you a standard REPL/nREPL connection. To work on tests use lein with-profiles +test repl
.
Add necessary classes to babashka/impl/classes.clj
. For every addition, write
a unit test, so it's clear why it is added and removing it will break the
tests. Try to reduce the size of the binary by only adding the necessary parts
of a class in :instance-check
, :constructors
, :methods
, :fields
or
:custom
.
The reflection.json
file that is needed for GraalVM compilation is generated
as part of script/uberjar
.
Test on the JVM (for development):
script/test
Test the native version:
BABASHKA_TEST_ENV=native script/test
Babashka runs tests of libraries that are compatible with it through
script/run_lib_tests
. To add tests for a new library, do the following:
deps.edn
under the :lib-tests
alias.test-resources/lib_tests/
and copy its tests to there.run_all_libtests.clj
to run the added test namespaces.See build.md.
Findings from various experiments with JDBC drivers in babashka:
bb
since
v0.0.89
.babashka.sqlite
namespace around the CLI maybe similar to
babashka.curl
. See #385
for details.To progress work on sqlite and mySQL, I need a working Clojure example. If you want to contribute, consider making a an example Clojure GraalVM CLI that puts something in a sqlite / mysql DB and reads something from it.
Keep notes here about how adding libraries and classes to Babashka affects the binary size. We're registering the size of the macOS binary (as built on CircleCI).
2020/10/30 Without httpkit client+server: 68113436. With: 69503316 = 1390kb added.
2020/05/01 Removed next.jdbc
and postgres JDBC driver: 48304980
2020/04/23 Added next.jdbc
and postgres JDBC driver:
(- 51019836 48099780) = 2920kb added
2020/04/23 Added BigDecimal (- 48103868 47857732) = 246kb added
2020/04/18 Added clojure.data.xml 47808572 - 45923028 = 1886kb added.
2020/03/29 Added clj-yaml for parsing and generating yaml. 45196996 - 42626884 = 2570kb added.
2020/03/28 Added java.nio.file.FileSystem(s) to support extracting zip files 42562284 - 42021244 = 541kb added.
2020/03/22 Added java.io.FileReader 42025276 - 42008876 = 16kb added.
2020/03/20 Added transit write, writer, read, reader 42004796 - 41025212 = 980kb added (305kb zipped).
2020/03/19 Added java.lang.NumberFormatException, java.lang.RuntimeException, java.util.MissingResourceException and java.util.Properties to support cprop. 41025180 - 40729908 = 295kb added.
2020/02/21 Added java.time.temporal.ChronoUnit 40651596 - 40598260 = 53kb added.
2020/02/19, e43727955a2cdabd2bb0189c20dd7f9a18156fc9 Added fipp.edn/pprint 40598268 - 39744804 = 853kb added.
2020/02/09, c8fd1c7931d7842ebaec1fa8faf06d4ab58573bd Added java.lang.BigInteger and java.security.MessageDigest. 39281972 - 39072764 = 209kb added.
2020/04/02 v0.0.69 38883676
2020/01/24, 43eef7075f9dac038d8d28a5ee4e49b6affd9864: 38.3mb, 11.1mb zipped Added hierarchies (derive, isa?, etc).
2020/01/23, 485fef7df54d6701936704573468a1ec4c66d221: 37.4mb / 10.9mb zipped Added: StringBuilder, java.io.{Reader,Writer,PrinterWriter,PushbackReader}
2020/01/08, 303ca9e825d76a4a45bc4240a59139d342c13964: 36.9mb / 10.8mb zipped
Removing cheshire from bb: 36.2mb / 10.5mb zipped.
Can you improve this documentation? These fine people already did:
Michiel Borkent, Gabriel Horner & Jeroen van DijkEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close