malli
This commit is contained in:
parent
d725499035
commit
cdbf94943e
8 changed files with 42 additions and 4 deletions
4
deps.edn
4
deps.edn
|
|
@ -7,6 +7,7 @@
|
||||||
"feature-hiccup"
|
"feature-hiccup"
|
||||||
"feature-test-check"
|
"feature-test-check"
|
||||||
"feature-spec-alpha"
|
"feature-spec-alpha"
|
||||||
|
"feature-malli"
|
||||||
"pods/src"
|
"pods/src"
|
||||||
"babashka.nrepl/src"
|
"babashka.nrepl/src"
|
||||||
"depstar/src" "process/src"
|
"depstar/src" "process/src"
|
||||||
|
|
@ -34,7 +35,8 @@
|
||||||
babashka/clojure-lanterna {:mvn/version "0.9.8-SNAPSHOT"}
|
babashka/clojure-lanterna {:mvn/version "0.9.8-SNAPSHOT"}
|
||||||
org.clojure/math.combinatorics {:mvn/version "0.1.6"}
|
org.clojure/math.combinatorics {:mvn/version "0.1.6"}
|
||||||
org.clojure/core.match {:mvn/version "1.0.0"}
|
org.clojure/core.match {:mvn/version "1.0.0"}
|
||||||
hiccup/hiccup {:mvn/version "2.0.0-alpha2"}}
|
hiccup/hiccup {:mvn/version "2.0.0-alpha2"}
|
||||||
|
metosin/malli {:mvn/version "0.2.1"}}
|
||||||
:aliases {:main
|
:aliases {:main
|
||||||
{:main-opts ["-m" "babashka.main"]}
|
{:main-opts ["-m" "babashka.main"]}
|
||||||
:profile
|
:profile
|
||||||
|
|
|
||||||
11
feature-malli/babashka/impl/malli.clj
Normal file
11
feature-malli/babashka/impl/malli.clj
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
(ns babashka.impl.malli
|
||||||
|
{:no-doc true}
|
||||||
|
(:require [malli.core :as m]
|
||||||
|
[sci.core :as sci :refer [copy-var]]))
|
||||||
|
|
||||||
|
(def mns (sci/create-ns 'malli.core nil))
|
||||||
|
|
||||||
|
(def malli-namespace
|
||||||
|
{'validate (copy-var m/validate mns)
|
||||||
|
'validator (copy-var m/validator mns)
|
||||||
|
})
|
||||||
|
|
@ -53,6 +53,8 @@
|
||||||
:dependencies [[hiccup/hiccup "2.0.0-alpha2"]]}
|
:dependencies [[hiccup/hiccup "2.0.0-alpha2"]]}
|
||||||
:feature/test-check {:source-paths ["feature-test-check"]}
|
:feature/test-check {:source-paths ["feature-test-check"]}
|
||||||
:feature/spec-alpha {:source-paths ["feature-spec-alpha"]}
|
:feature/spec-alpha {:source-paths ["feature-spec-alpha"]}
|
||||||
|
:feature/malli {:source-paths ["feature-malli"]
|
||||||
|
:dependencies [[metosin/malli "0.2.1"]]}
|
||||||
:test [:feature/xml
|
:test [:feature/xml
|
||||||
:feature/lanterna
|
:feature/lanterna
|
||||||
:feature/yaml
|
:feature/yaml
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ then
|
||||||
export BABASHKA_FEATURE_HICCUP="${BABASHKA_FEATURE_HICCUP:-false}"
|
export BABASHKA_FEATURE_HICCUP="${BABASHKA_FEATURE_HICCUP:-false}"
|
||||||
export BABASHKA_FEATURE_TEST_CHECK="${BABASHKA_FEATURE_TEST_CHECK:-false}"
|
export BABASHKA_FEATURE_TEST_CHECK="${BABASHKA_FEATURE_TEST_CHECK:-false}"
|
||||||
export BABASHKA_FEATURE_SPEC_ALPHA="${BABASHKA_FEATURE_SPEC_ALPHA:-false}"
|
export BABASHKA_FEATURE_SPEC_ALPHA="${BABASHKA_FEATURE_SPEC_ALPHA:-false}"
|
||||||
|
export BABASHKA_FEATURE_MALLI="${BABASHKA_FEATURE_MALLI:-false}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$GRAALVM_HOME/bin/native-image" "${args[@]}"
|
"$GRAALVM_HOME/bin/native-image" "${args[@]}"
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,13 @@ else
|
||||||
BABASHKA_LEIN_PROFILES+=",-feature/spec-alpha"
|
BABASHKA_LEIN_PROFILES+=",-feature/spec-alpha"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$BABASHKA_FEATURE_MALLI" != "false" ]
|
||||||
|
then
|
||||||
|
BABASHKA_LEIN_PROFILES+=",+feature/malli"
|
||||||
|
else
|
||||||
|
BABASHKA_LEIN_PROFILES+=",-feature/malli"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$BABASHKA_JAR" ]; then
|
if [ -z "$BABASHKA_JAR" ]; then
|
||||||
lein with-profiles "$BABASHKA_LEIN_PROFILES,+reflection,-uberjar" do run
|
lein with-profiles "$BABASHKA_LEIN_PROFILES,+reflection,-uberjar" do run
|
||||||
lein with-profiles "$BABASHKA_LEIN_PROFILES" do clean, uberjar
|
lein with-profiles "$BABASHKA_LEIN_PROFILES" do clean, uberjar
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,13 @@ set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/spec-alpha
|
||||||
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/spec-alpha
|
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/spec-alpha
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not "%BABASHKA_FEATURE_MALLI%"=="false" (
|
||||||
|
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/malli
|
||||||
|
) else (
|
||||||
|
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/malli
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
call lein with-profiles %BABASHKA_LEIN_PROFILES% bb "(+ 1 2 3)"
|
call lein with-profiles %BABASHKA_LEIN_PROFILES% bb "(+ 1 2 3)"
|
||||||
|
|
||||||
call lein with-profiles %BABASHKA_LEIN_PROFILES%,+reflection,-uberjar do run
|
call lein with-profiles %BABASHKA_LEIN_PROFILES%,+reflection,-uberjar do run
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
(def core-match? (not= "false" (System/getenv "BABASHKA_FEATURE_CORE_MATCH")))
|
(def core-match? (not= "false" (System/getenv "BABASHKA_FEATURE_CORE_MATCH")))
|
||||||
(def hiccup? (not= "false" (System/getenv "BABASHKA_FEATURE_HICCUP")))
|
(def hiccup? (not= "false" (System/getenv "BABASHKA_FEATURE_HICCUP")))
|
||||||
(def test-check? (not= "false" (System/getenv "BABASHKA_FEATURE_TEST_CHECK")))
|
(def test-check? (not= "false" (System/getenv "BABASHKA_FEATURE_TEST_CHECK")))
|
||||||
|
(def malli? (not= "false" (System/getenv "BABASHKA_FEATURE_MALLI")))
|
||||||
|
|
||||||
;; excluded by default
|
;; excluded by default
|
||||||
(def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC")))
|
(def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC")))
|
||||||
|
|
@ -66,3 +67,6 @@
|
||||||
|
|
||||||
(when spec-alpha?
|
(when spec-alpha?
|
||||||
(require '[babashka.impl.spec]))
|
(require '[babashka.impl.spec]))
|
||||||
|
|
||||||
|
(when malli?
|
||||||
|
(require '[babashka.impl.malli]))
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,8 @@ Use -- to separate script command line args from bb command line args.
|
||||||
:feature/core-match %s
|
:feature/core-match %s
|
||||||
:feature/hiccup %s
|
:feature/hiccup %s
|
||||||
:feature/test-check %s
|
:feature/test-check %s
|
||||||
:feature/spec-alpha %s}")
|
:feature/spec-alpha %s
|
||||||
|
:feature/malli %s}")
|
||||||
version
|
version
|
||||||
features/core-async?
|
features/core-async?
|
||||||
features/csv?
|
features/csv?
|
||||||
|
|
@ -290,7 +291,8 @@ Use -- to separate script command line args from bb command line args.
|
||||||
features/core-match?
|
features/core-match?
|
||||||
features/hiccup?
|
features/hiccup?
|
||||||
features/test-check?
|
features/test-check?
|
||||||
features/spec-alpha?)))
|
features/spec-alpha?
|
||||||
|
features/malli?)))
|
||||||
|
|
||||||
(defn read-file [file]
|
(defn read-file [file]
|
||||||
(let [f (io/file file)]
|
(let [f (io/file file)]
|
||||||
|
|
@ -421,7 +423,9 @@ Use -- to separate script command line args from bb command line args.
|
||||||
features/spec-alpha? (-> (assoc ;; spec
|
features/spec-alpha? (-> (assoc ;; spec
|
||||||
'clojure.spec.alpha @(resolve 'babashka.impl.spec/spec-namespace)
|
'clojure.spec.alpha @(resolve 'babashka.impl.spec/spec-namespace)
|
||||||
'clojure.spec.gen.alpha @(resolve 'babashka.impl.spec/gen-namespace)
|
'clojure.spec.gen.alpha @(resolve 'babashka.impl.spec/gen-namespace)
|
||||||
'clojure.spec.test.alpha @(resolve 'babashka.impl.spec/test-namespace)))))
|
'clojure.spec.test.alpha @(resolve 'babashka.impl.spec/test-namespace)))
|
||||||
|
features/malli? (assoc 'malli.core
|
||||||
|
@(resolve 'babashka.impl.malli/malli-namespace))))
|
||||||
|
|
||||||
(def imports
|
(def imports
|
||||||
'{ArithmeticException java.lang.ArithmeticException
|
'{ArithmeticException java.lang.ArithmeticException
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue