[#296] add support for cprops lib (#297)

This commit is contained in:
Michiel Borkent 2020-03-20 14:28:19 +01:00 committed by GitHub
parent 645cea071e
commit 5b50ba760e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 5 deletions

View file

@ -53,11 +53,12 @@ Then run:
Keep notes here about how adding libraries and classes to Babashka affects the binary size.
<!-- On macOS: -->
2020/03/19 Added java.lang.NumberFormatException, java.lang.RuntimeException,
java.util.MissingResourceException and java.util.Properties to support
[cprop](https://github.com/tolitius/cprop/).
41025180 - 40729908 = 295kb added.
<!-- 2020/01/08, ..., 38.7mb / 11.3mb zipped -->
<!-- Added: `clojure.data.xml`. Growth: 1.8mb / ... -->
2020/02/21,
2020/02/21
Added java.time.temporal.ChronoUnit
40651596 - 40598260 = 53kb added.

18
script/lib_tests/cprop_test Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eo pipefail
export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {cprop {:mvn/version "0.1.16"}}}')
if [ "$BABASHKA_TEST_ENV" = "native" ]; then
BB_CMD="./bb"
else
BB_CMD="lein bb"
fi
CPROP_ENV="hello" $BB_CMD "
(require '[cprop.core :refer [load-config]])
(require '[cprop.source :refer [from-system-props from-env]])
(println (:cprop-env (from-env)))
"

View file

@ -9,3 +9,4 @@ script/lib_tests/clojure_csv_test
script/lib_tests/regal_test
script/lib_tests/medley_test
script/lib_tests/babashka_curl_test
script/lib_tests/cprop_test

View file

@ -33,7 +33,9 @@
java.lang.Exception
java.lang.Integer
java.lang.Long
java.lang.NumberFormatException
java.lang.Math
java.lang.RuntimeException
java.util.concurrent.LinkedBlockingQueue
java.lang.Object
java.lang.String
@ -90,6 +92,8 @@
java.util.Base64$Decoder
java.util.Base64$Encoder
java.util.Date
java.util.MissingResourceException
java.util.Properties
java.util.UUID
java.util.concurrent.TimeUnit
java.util.zip.InflaterInputStream

View file

@ -2,6 +2,7 @@
{:no-doc true}
(:refer-clojure :exclude [future read read-string])
(:require [borkdude.graal.locking :as locking]
[sci.core :as sci]
[sci.impl.namespaces :refer [copy-core-var]]))
(defn locking* [form bindings v f & args]
@ -29,4 +30,5 @@
'spit (copy-core-var spit)
'time (with-meta time* {:sci/macro true})
'Throwable->map (copy-core-var Throwable->map)
'compare-and-set! (copy-core-var compare-and-set!)})
'compare-and-set! (copy-core-var compare-and-set!)
'*data-readers* (sci/new-dynamic-var '*data-readers* nil)})

View file

@ -343,7 +343,9 @@ Everything after that is bound to *command-line-args*."))
File java.io.File
Long java.lang.Long
Math java.lang.Math
NumberFormatException java.lang.NumberFormatException
Object java.lang.Object
RuntimeException java.lang.RuntimeException
ProcessBuilder java.lang.ProcessBuilder
String java.lang.String
StringBuilder java.lang.StringBuilder