[#389] YAML feature flag
This commit is contained in:
parent
6c255a702e
commit
cd96a380ba
8 changed files with 32 additions and 14 deletions
|
|
@ -21,14 +21,16 @@
|
|||
[org.clojure/data.csv "1.0.0"]
|
||||
[cheshire "5.10.0"]
|
||||
[fipp "0.6.22"]
|
||||
[clj-commons/clj-yaml "0.7.1"]
|
||||
[com.cognitect/transit-clj "1.0.324"]
|
||||
[seancorfield/next.jdbc "1.0.424"]
|
||||
[org.postgresql/postgresql "42.2.12"]]
|
||||
:profiles {:feature/xml {:source-paths ["src-xml"]
|
||||
:dependencies [[org.clojure/data.xml "0.2.0-alpha6"]]}
|
||||
:feature/yaml {:source-paths ["src-yaml"]
|
||||
:dependencies [[clj-commons/clj-yaml "0.7.1"]]}
|
||||
:feature/hsqldb {:dependencies [[org.hsqldb/hsqldb "2.4.0"]]}
|
||||
:test [:feature/xml
|
||||
:feature/yaml
|
||||
:feature/hsqldb
|
||||
{:dependencies [[clj-commons/conch "0.9.2"]
|
||||
[com.clojure-goes-fast/clj-async-profiler "0.4.1"]]}]
|
||||
|
|
@ -38,7 +40,7 @@
|
|||
:main babashka.main
|
||||
:aot :all}
|
||||
:reflection {:main babashka.impl.classes/generate-reflection-file}}
|
||||
:aliases {"bb" ["with-profiles" "+feature/xml,+feature/hsqldb" "run" "-m" "babashka.main"]}
|
||||
:aliases {"bb" ["with-profile" "test" "run" "-m" "babashka.main"]}
|
||||
:deploy-repositories [["clojars" {:url "https://clojars.org/repo"
|
||||
:username :env/clojars_user
|
||||
:password :env/clojars_pass
|
||||
|
|
|
|||
|
|
@ -84,7 +84,3 @@ if [ "$BABASHKA_FEATURE_HSQLDB" = "true" ]; then
|
|||
fi
|
||||
|
||||
$GRAALVM_HOME/bin/native-image "${args[@]}"
|
||||
|
||||
if [ ! -z "$(command -v lein)" ]; then
|
||||
lein clean
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@ else
|
|||
BABASHKA_LEIN_PROFILES+=",-feature/xml"
|
||||
fi
|
||||
|
||||
if [ "$BABASHKA_FEATURE_YAML" != "false" ]
|
||||
then
|
||||
BABASHKA_LEIN_PROFILES+=",+feature/yaml"
|
||||
else
|
||||
BABASHKA_LEIN_PROFILES+=",-feature/yaml"
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "$BABASHKA_JAR" ]; then
|
||||
lein with-profiles "+reflection,$BABASHKA_LEIN_PROFILES" do run
|
||||
lein with-profiles "+uberjar,$BABASHKA_LEIN_PROFILES" do clean, uberjar
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ if not "%BABASHKA_FEATURE_XML%"=="false" (
|
|||
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/xml
|
||||
)
|
||||
|
||||
if not "%BABASHKA_FEATURE_YAML%"=="false" (
|
||||
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/yaml
|
||||
) else (
|
||||
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/yaml
|
||||
)
|
||||
|
||||
call lein with-profiles %BABASHKA_LEIN_PROFILES% bb "(+ 1 2 3)"
|
||||
|
||||
call lein with-profiles +reflection,%BABASHKA_LEIN_PROFILES% do run
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@
|
|||
java.util.zip.DeflaterInputStream
|
||||
java.util.zip.GZIPInputStream
|
||||
java.util.zip.GZIPOutputStream
|
||||
org.yaml.snakeyaml.error.YAMLException
|
||||
~(symbol "[B")
|
||||
~@(when features/yaml? [`org.yaml.snakeyaml.error.YAMLException])
|
||||
~@(when features/hsqldb? [`org.hsqldb.jdbcDriver])]
|
||||
:constructors [clojure.lang.Delay
|
||||
clojure.lang.MapEntry
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
(ns babashka.impl.features
|
||||
{:no-doc true})
|
||||
|
||||
(def xml? (not= "false" (System/getenv "BABASHKA_FEATURE_XML"))) ;; included by default
|
||||
(def hsqldb? (= "true" (System/getenv "BABASHKA_FEATURE_HSQLDB"))) ;; excluded by default
|
||||
;; included by default
|
||||
(def yaml? (not= "false" (System/getenv "BABASHKA_FEATURE_YAML")))
|
||||
(def xml? (not= "false" (System/getenv "BABASHKA_FEATURE_XML")))
|
||||
|
||||
;; excluded by default
|
||||
(def hsqldb? (= "true" (System/getenv "BABASHKA_FEATURE_HSQLDB")))
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
[babashka.impl.test :as t]
|
||||
[babashka.impl.tools.cli :refer [tools-cli-namespace]]
|
||||
[babashka.impl.transit :refer [transit-namespace]]
|
||||
[babashka.impl.yaml :refer [yaml-namespace]]
|
||||
[babashka.wait :as wait]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.java.io :as io]
|
||||
|
|
@ -60,6 +59,9 @@
|
|||
(when features/xml?
|
||||
(require '[babashka.impl.xml]))
|
||||
|
||||
(when features/yaml?
|
||||
(require '[babashka.impl.yaml]))
|
||||
|
||||
(binding [*unrestricted* true]
|
||||
(sci/alter-var-root sci/in (constantly *in*))
|
||||
(sci/alter-var-root sci/out (constantly *out*))
|
||||
|
|
@ -276,12 +278,12 @@ Everything after that is bound to *command-line-args*."))
|
|||
async clojure.core.async
|
||||
csv clojure.data.csv
|
||||
json cheshire.core
|
||||
yaml clj-yaml.core
|
||||
curl babashka.curl
|
||||
transit cognitect.transit
|
||||
bencode bencode.core
|
||||
jdbc next.jdbc}
|
||||
features/xml? (assoc 'xml 'clojure.data.xml)))
|
||||
features/xml? (assoc 'xml 'clojure.data.xml)
|
||||
features/yaml? (assoc 'yaml 'clj-yaml.core)))
|
||||
|
||||
(def cp-state (atom nil))
|
||||
|
||||
|
|
@ -312,14 +314,14 @@ Everything after that is bound to *command-line-args*."))
|
|||
'repl-requires clojure-main/repl-requires}
|
||||
'clojure.test t/clojure-test-namespace
|
||||
'babashka.classpath {'add-classpath add-classpath*}
|
||||
'clj-yaml.core yaml-namespace
|
||||
'clojure.pprint pprint-namespace
|
||||
'babashka.curl curl-namespace
|
||||
'cognitect.transit transit-namespace
|
||||
'bencode.core bencode-namespace
|
||||
'next.jdbc jdbc/njdbc-namespace
|
||||
'next.jdbc.sql jdbc/next-sql-namespace}
|
||||
features/xml? (assoc 'clojure.data.xml @(resolve 'babashka.impl.xml/xml-namespace))))
|
||||
features/xml? (assoc 'clojure.data.xml @(resolve 'babashka.impl.xml/xml-namespace))
|
||||
features/yaml? (assoc 'clj-yaml.core @(resolve 'babashka.impl.yaml/yaml-namespace))))
|
||||
|
||||
(def bindings
|
||||
{'java.lang.System/exit exit ;; override exit, so we have more control
|
||||
|
|
|
|||
Loading…
Reference in a new issue