version-clj
This commit is contained in:
parent
3035fef138
commit
dc930250a4
7 changed files with 33 additions and 47 deletions
1
deps.edn
1
deps.edn
|
|
@ -8,6 +8,7 @@
|
||||||
"feature-test-check"
|
"feature-test-check"
|
||||||
"feature-spec-alpha"
|
"feature-spec-alpha"
|
||||||
"feature-rewrite-clj"
|
"feature-rewrite-clj"
|
||||||
|
"feature-version-clj"
|
||||||
"pods/src"
|
"pods/src"
|
||||||
"babashka.nrepl/src"
|
"babashka.nrepl/src"
|
||||||
"depstar/src" "process/src"
|
"depstar/src" "process/src"
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,9 @@
|
||||||
(ns babashka.impl.rewrite-clj
|
(ns babashka.impl.version-clj
|
||||||
{:no-doc true}
|
{:no-doc true}
|
||||||
(:require [version-clj.core :as v]
|
(:require [sci.core :as sci]
|
||||||
[sci.core :as sci]))
|
[version-clj.core]))
|
||||||
|
|
||||||
(def nns (sci/create-ns 'rewrite-clj.node nil))
|
(def vns (sci/create-ns 'version-clj.core nil))
|
||||||
(def pens (sci/create-ns 'rewrite-clj.paredit nil))
|
|
||||||
(def pns (sci/create-ns 'rewrite-clj.parser nil))
|
|
||||||
(def zns (sci/create-ns 'rewrite-clj.zip nil))
|
|
||||||
(def zsns (sci/create-ns 'rewrite-clj.zip.subedit nil))
|
|
||||||
|
|
||||||
#_(defmacro copy-var
|
|
||||||
"Copies contents from var `sym` to a new sci var. The value `ns` is an
|
|
||||||
object created with `sci.core/create-ns`."
|
|
||||||
([sym ns]
|
|
||||||
`(let [ns# ~ns
|
|
||||||
var# (var ~sym)
|
|
||||||
val# (deref var#)
|
|
||||||
m# (-> var# meta)
|
|
||||||
ns-name# (vars/getName ns#)
|
|
||||||
name# (:name m#)
|
|
||||||
name-sym# (symbol (str ns-name#) (str name#))
|
|
||||||
new-m# {:doc (:doc m#)
|
|
||||||
:name name#
|
|
||||||
:arglists (:arglists m#)
|
|
||||||
:ns ns#}]
|
|
||||||
(cond (:dynamic m#)
|
|
||||||
(new-dynamic-var name# val# new-m#)
|
|
||||||
(:macro m#)
|
|
||||||
(new-macro-var name# val# new-m#)
|
|
||||||
:else (new-var name# val# new-m#)))))
|
|
||||||
|
|
||||||
(defn make-ns [ns sci-ns]
|
(defn make-ns [ns sci-ns]
|
||||||
(reduce (fn [ns-map [var-name var]]
|
(reduce (fn [ns-map [var-name var]]
|
||||||
|
|
@ -47,17 +22,5 @@
|
||||||
{}
|
{}
|
||||||
(ns-publics ns)))
|
(ns-publics ns)))
|
||||||
|
|
||||||
(def node-namespace
|
(def version-clj-namespace
|
||||||
(make-ns 'rewrite-clj.node nns))
|
(make-ns 'version-clj.core vns))
|
||||||
|
|
||||||
(def parser-namespace
|
|
||||||
(make-ns 'rewrite-clj.parser pns))
|
|
||||||
|
|
||||||
(def paredit-namespace
|
|
||||||
(make-ns 'rewrite-clj.paredit pens))
|
|
||||||
|
|
||||||
(def zip-namespace
|
|
||||||
(make-ns 'rewrite-clj.zip zns))
|
|
||||||
|
|
||||||
(def subedit-namespace
|
|
||||||
(make-ns 'rewrite-clj.zip.subedit zsns))
|
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ then
|
||||||
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_REWRITE_CLJ="${BABASHKA_FEATURE_REWRITE_CLJ:-false}"
|
export BABASHKA_FEATURE_REWRITE_CLJ="${BABASHKA_FEATURE_REWRITE_CLJ:-false}"
|
||||||
|
export BABASHKA_FEATURE_REWRITE_CLJ="${BABASHKA_FEATURE_VERSION_CLJ:-false}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$GRAALVM_HOME/bin/native-image" "${args[@]}"
|
"$GRAALVM_HOME/bin/native-image" "${args[@]}"
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,13 @@ else
|
||||||
BABASHKA_LEIN_PROFILES+=",-feature/rewrite-clj"
|
BABASHKA_LEIN_PROFILES+=",-feature/rewrite-clj"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$BABASHKA_FEATURE_VERSION_CLJ" != "false" ]
|
||||||
|
then
|
||||||
|
BABASHKA_LEIN_PROFILES+=",+feature/version-clj"
|
||||||
|
else
|
||||||
|
BABASHKA_LEIN_PROFILES+=",-feature/version-clj"
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,11 @@ set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/rewrite-clj
|
||||||
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/rewrite-clj
|
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/rewrite-clj
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not "%BABASHKA_FEATURE_VERSION_CLJ%"=="false" (
|
||||||
|
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/version-clj
|
||||||
|
) else (
|
||||||
|
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/version-clj
|
||||||
|
)
|
||||||
|
|
||||||
call lein with-profiles %BABASHKA_LEIN_PROFILES% bb "(+ 1 2 3)"
|
call lein with-profiles %BABASHKA_LEIN_PROFILES% bb "(+ 1 2 3)"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
(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 rewrite-clj? (not= "false" (System/getenv "BABASHKA_FEATURE_REWRITE_CLJ")))
|
(def rewrite-clj? (not= "false" (System/getenv "BABASHKA_FEATURE_REWRITE_CLJ")))
|
||||||
|
(def version-clj? (not= "false" (System/getenv "BABASHKA_FEATURE_VERSION_CLJ")))
|
||||||
|
|
||||||
;; excluded by default
|
;; excluded by default
|
||||||
(def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC")))
|
(def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC")))
|
||||||
|
|
@ -70,3 +71,6 @@
|
||||||
|
|
||||||
(when rewrite-clj?
|
(when rewrite-clj?
|
||||||
(require '[babashka.impl.rewrite-clj]))
|
(require '[babashka.impl.rewrite-clj]))
|
||||||
|
|
||||||
|
(when version-clj?
|
||||||
|
(require '[babashka.impl.version-clj]))
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,8 @@ When no eval opts or subcommand is provided, the implicit subcommand is repl.")
|
||||||
:feature/hiccup %s
|
:feature/hiccup %s
|
||||||
:feature/test-check %s
|
:feature/test-check %s
|
||||||
:feature/spec-alpha %s
|
:feature/spec-alpha %s
|
||||||
:feature/rewrite-clj %s}")
|
:feature/rewrite-clj %s
|
||||||
|
:feature/version-clj %s}")
|
||||||
version
|
version
|
||||||
features/core-async?
|
features/core-async?
|
||||||
features/csv?
|
features/csv?
|
||||||
|
|
@ -209,7 +210,8 @@ When no eval opts or subcommand is provided, the implicit subcommand is repl.")
|
||||||
features/hiccup?
|
features/hiccup?
|
||||||
features/test-check?
|
features/test-check?
|
||||||
features/spec-alpha?
|
features/spec-alpha?
|
||||||
features/rewrite-clj?)))
|
features/rewrite-clj?
|
||||||
|
features/version-clj?)))
|
||||||
|
|
||||||
(defn read-file [file]
|
(defn read-file [file]
|
||||||
(let [f (io/file file)]
|
(let [f (io/file file)]
|
||||||
|
|
@ -260,7 +262,8 @@ When no eval opts or subcommand is provided, the implicit subcommand is repl.")
|
||||||
features/jdbc? (assoc 'jdbc 'next.jdbc)
|
features/jdbc? (assoc 'jdbc 'next.jdbc)
|
||||||
features/core-async? (assoc 'async 'clojure.core.async)
|
features/core-async? (assoc 'async 'clojure.core.async)
|
||||||
features/csv? (assoc 'csv 'clojure.data.csv)
|
features/csv? (assoc 'csv 'clojure.data.csv)
|
||||||
features/transit? (assoc 'transit 'cognitect.transit)))
|
features/transit? (assoc 'transit 'cognitect.transit)
|
||||||
|
features/version-clj? (assoc 'version 'version-clj.core)))
|
||||||
|
|
||||||
;;(def ^:private server-ns-obj (sci/create-ns 'clojure.core.server nil))
|
;;(def ^:private server-ns-obj (sci/create-ns 'clojure.core.server nil))
|
||||||
|
|
||||||
|
|
@ -349,7 +352,9 @@ When no eval opts or subcommand is provided, the implicit subcommand is repl.")
|
||||||
'rewrite-clj.zip
|
'rewrite-clj.zip
|
||||||
@(resolve 'babashka.impl.rewrite-clj/zip-namespace)
|
@(resolve 'babashka.impl.rewrite-clj/zip-namespace)
|
||||||
'rewrite-clj.zip.subedit
|
'rewrite-clj.zip.subedit
|
||||||
@(resolve 'babashka.impl.rewrite-clj/subedit-namespace))))
|
@(resolve 'babashka.impl.rewrite-clj/subedit-namespace))
|
||||||
|
features/version-clj? (assoc 'version-clj.core
|
||||||
|
@(resolve 'babashka.impl.version-clj/version-clj-namespace))))
|
||||||
|
|
||||||
(def imports
|
(def imports
|
||||||
'{ArithmeticException java.lang.ArithmeticException
|
'{ArithmeticException java.lang.ArithmeticException
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue