parent
cac8273277
commit
ab008870b8
11 changed files with 116 additions and 67 deletions
|
|
@ -52,7 +52,7 @@ jobs:
|
||||||
name: Create uberjar
|
name: Create uberjar
|
||||||
command: |
|
command: |
|
||||||
mkdir -p /tmp/release
|
mkdir -p /tmp/release
|
||||||
lein do clean, uberjar
|
script/uberjar
|
||||||
VERSION=$(cat resources/BABASHKA_VERSION)
|
VERSION=$(cat resources/BABASHKA_VERSION)
|
||||||
cp target/babashka-$VERSION-standalone.jar /tmp/release/babashka-$VERSION-standalone.jar
|
cp target/babashka-$VERSION-standalone.jar /tmp/release/babashka-$VERSION-standalone.jar
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
|
|
@ -109,6 +109,7 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Build binary
|
name: Build binary
|
||||||
command: |
|
command: |
|
||||||
|
script/uberjar
|
||||||
script/compile
|
script/compile
|
||||||
no_output_timeout: 30m
|
no_output_timeout: 30m
|
||||||
- run:
|
- run:
|
||||||
|
|
@ -180,6 +181,7 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Build binary
|
name: Build binary
|
||||||
command: |
|
command: |
|
||||||
|
script/uberjar
|
||||||
script/compile
|
script/compile
|
||||||
no_output_timeout: 30m
|
no_output_timeout: 30m
|
||||||
- run:
|
- run:
|
||||||
|
|
@ -242,6 +244,7 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Build binary
|
name: Build binary
|
||||||
command: |
|
command: |
|
||||||
|
script/uberjar
|
||||||
script/compile
|
script/compile
|
||||||
no_output_timeout: 30m
|
no_output_timeout: 30m
|
||||||
- run:
|
- run:
|
||||||
|
|
|
||||||
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
|
|
@ -54,8 +54,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build uberjar
|
- name: Build uberjar
|
||||||
run: |
|
run: |
|
||||||
lein with-profiles +reflection do run
|
script/uberjar
|
||||||
lein do clean, uberjar
|
|
||||||
|
|
||||||
- name: Babashka version
|
- name: Babashka version
|
||||||
id: babashka-version
|
id: babashka-version
|
||||||
|
|
|
||||||
2
deps.edn
2
deps.edn
|
|
@ -1,4 +1,4 @@
|
||||||
{:paths ["src" "sci/src" "babashka.curl/src" "resources" "sci/resources"],
|
{:paths ["src" "src-xml" "sci/src" "babashka.curl/src" "resources" "sci/resources"],
|
||||||
:deps {org.clojure/clojure {:mvn/version "1.10.2-alpha1"},
|
:deps {org.clojure/clojure {:mvn/version "1.10.2-alpha1"},
|
||||||
org.clojure/tools.reader {:mvn/version "1.3.2"},
|
org.clojure/tools.reader {:mvn/version "1.3.2"},
|
||||||
borkdude/edamame {:mvn/version "0.0.11-alpha.9"},
|
borkdude/edamame {:mvn/version "0.0.11-alpha.9"},
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,12 @@ $ git submodule update --recursive
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
Run the `compile` script:
|
First run `script/uberjar` to create the `.jar` file. Then run `script/compile`.
|
||||||
|
|
||||||
``` shell
|
|
||||||
$ script/compile
|
|
||||||
```
|
|
||||||
|
|
||||||
To configure maximum heap size you can use:
|
To configure maximum heap size you can use:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ BABASHKA_XMX="-J-Xmx4g" script/compile
|
$ BABASHKA_XMX="-J-Xmx4800m" script/compile
|
||||||
```
|
```
|
||||||
|
|
||||||
## Windows
|
## Windows
|
||||||
|
|
|
||||||
13
project.clj
13
project.clj
|
|
@ -19,23 +19,26 @@
|
||||||
[org.clojure/core.async "1.1.587"]
|
[org.clojure/core.async "1.1.587"]
|
||||||
[org.clojure/tools.cli "1.0.194"]
|
[org.clojure/tools.cli "1.0.194"]
|
||||||
[org.clojure/data.csv "1.0.0"]
|
[org.clojure/data.csv "1.0.0"]
|
||||||
[org.clojure/data.xml "0.2.0-alpha6"]
|
|
||||||
[cheshire "5.10.0"]
|
[cheshire "5.10.0"]
|
||||||
[fipp "0.6.22"]
|
[fipp "0.6.22"]
|
||||||
[clj-commons/clj-yaml "0.7.1"]
|
[clj-commons/clj-yaml "0.7.1"]
|
||||||
[com.cognitect/transit-clj "1.0.324"]
|
[com.cognitect/transit-clj "1.0.324"]
|
||||||
[seancorfield/next.jdbc "1.0.424"]
|
[seancorfield/next.jdbc "1.0.424"]
|
||||||
[org.postgresql/postgresql "42.2.12"]]
|
[org.postgresql/postgresql "42.2.12"]]
|
||||||
:profiles {:feature/hsqldb {:dependencies [[org.hsqldb/hsqldb "2.4.0"]]}
|
:profiles {:feature/xml {:source-paths ["src-xml"]
|
||||||
:test {:dependencies [[clj-commons/conch "0.9.2"]
|
:dependencies [[org.clojure/data.xml "0.2.0-alpha6"]]}
|
||||||
[com.clojure-goes-fast/clj-async-profiler "0.4.1"]]}
|
:feature/hsqldb {:dependencies [[org.hsqldb/hsqldb "2.4.0"]]}
|
||||||
|
:test [:feature/xml
|
||||||
|
:feature/hsqldb
|
||||||
|
{:dependencies [[clj-commons/conch "0.9.2"]
|
||||||
|
[com.clojure-goes-fast/clj-async-profiler "0.4.1"]]}]
|
||||||
:uberjar {:global-vars {*assert* false}
|
:uberjar {:global-vars {*assert* false}
|
||||||
:jvm-opts ["-Dclojure.compiler.direct-linking=true"
|
:jvm-opts ["-Dclojure.compiler.direct-linking=true"
|
||||||
"-Dclojure.spec.skip-macros=true"]
|
"-Dclojure.spec.skip-macros=true"]
|
||||||
:main babashka.main
|
:main babashka.main
|
||||||
:aot :all}
|
:aot :all}
|
||||||
:reflection {:main babashka.impl.classes/generate-reflection-file}}
|
:reflection {:main babashka.impl.classes/generate-reflection-file}}
|
||||||
:aliases {"bb" ["run" "-m" "babashka.main"]}
|
:aliases {"bb" ["with-profiles" "+feature/xml,+feature/hsqldb" "run" "-m" "babashka.main"]}
|
||||||
:deploy-repositories [["clojars" {:url "https://clojars.org/repo"
|
:deploy-repositories [["clojars" {:url "https://clojars.org/repo"
|
||||||
:username :env/clojars_user
|
:username :env/clojars_user
|
||||||
:password :env/clojars_pass
|
:password :env/clojars_pass
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -eo pipefail
|
set -eou pipefail
|
||||||
|
|
||||||
if [ -z "$BABASHKA_XMX" ]; then
|
if [ -z "$BABASHKA_XMX" ]; then
|
||||||
export BABASHKA_XMX="-J-Xmx4500m"
|
export BABASHKA_XMX="-J-Xmx4500m"
|
||||||
|
|
@ -11,9 +11,18 @@ if [ -z "$GRAALVM_HOME" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BABASHKA_VERSION=$(cat resources/BABASHKA_VERSION)
|
||||||
|
|
||||||
|
BABASHKA_JAR=${BABASHKA_JAR:-"target/babashka-$BABASHKA_VERSION-standalone.jar"}
|
||||||
|
|
||||||
|
if [[ ! -f "$BABASHKA_JAR" ]]
|
||||||
|
then
|
||||||
|
echo "Please run script/uberjar first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
$GRAALVM_HOME/bin/gu install native-image
|
$GRAALVM_HOME/bin/gu install native-image
|
||||||
|
|
||||||
BABASHKA_VERSION=$(cat resources/BABASHKA_VERSION)
|
|
||||||
|
|
||||||
export JAVA_HOME=$GRAALVM_HOME
|
export JAVA_HOME=$GRAALVM_HOME
|
||||||
|
|
||||||
|
|
@ -23,15 +32,22 @@ $GRAALVM_HOME/bin/javac -cp "$SVM_JAR" resources/CutOffCoreServicesDependencies.
|
||||||
|
|
||||||
BABASHKA_LEIN_PROFILES=""
|
BABASHKA_LEIN_PROFILES=""
|
||||||
|
|
||||||
|
BABASHKA_FEATURE_HSQLDB=${BABASHKA_FEATURE_HSQLDB:-}
|
||||||
|
|
||||||
if [ "$BABASHKA_FEATURE_HSQLDB" = "true" ]
|
if [ "$BABASHKA_FEATURE_HSQLDB" = "true" ]
|
||||||
then
|
then
|
||||||
BABASHKA_LEIN_PROFILES="+feature/hsqldb"
|
BABASHKA_LEIN_PROFILES+="+feature/hsqldb"
|
||||||
|
else
|
||||||
|
BABASHKA_LEIN_PROFILES+="-feature/hsqldb"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$BABASHKA_JAR" ]; then
|
BABASHKA_FEATURE_XML=${BABASHKA_FEATURE_XML:-}
|
||||||
lein with-profiles "+reflection,$BABASHKA_LEIN_PROFILES" do run
|
|
||||||
lein with-profiles "+uberjar,$BABASHKA_LEIN_PROFILES" do clean, uberjar
|
if [ "$BABASHKA_FEATURE_XML" != "false" ]
|
||||||
BABASHKA_JAR=${BABASHKA_JAR:-"target/babashka-$BABASHKA_VERSION-standalone.jar"}
|
then
|
||||||
|
BABASHKA_LEIN_PROFILES+=",+feature/xml"
|
||||||
|
else
|
||||||
|
BABASHKA_LEIN_PROFILES+=",-feature/xml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BABASHKA_BINARY=${BABASHKA_BINARY:-"bb"}
|
BABASHKA_BINARY=${BABASHKA_BINARY:-"bb"}
|
||||||
|
|
@ -57,6 +73,8 @@ args=( -jar $BABASHKA_JAR \
|
||||||
"--initialize-at-run-time=org.postgresql.sspi.SSPIClient" \
|
"--initialize-at-run-time=org.postgresql.sspi.SSPIClient" \
|
||||||
"$BABASHKA_XMX" )
|
"$BABASHKA_XMX" )
|
||||||
|
|
||||||
|
BABASHKA_STATIC=${BABASHKA_STATIC:-}
|
||||||
|
|
||||||
if [ "$BABASHKA_STATIC" = "true" ]; then
|
if [ "$BABASHKA_STATIC" = "true" ]; then
|
||||||
args+=("--static")
|
args+=("--static")
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
24
script/uberjar
Executable file
24
script/uberjar
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
BABASHKA_LEIN_PROFILES=""
|
||||||
|
|
||||||
|
if [ "$BABASHKA_FEATURE_HSQLDB" = "true" ]
|
||||||
|
then
|
||||||
|
BABASHKA_LEIN_PROFILES+="+feature/hsqldb"
|
||||||
|
else
|
||||||
|
BABASHKA_LEIN_PROFILES+="-feature/hsqldb"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$BABASHKA_FEATURE_XML" != "false" ]
|
||||||
|
then
|
||||||
|
BABASHKA_LEIN_PROFILES+=",+feature/xml"
|
||||||
|
else
|
||||||
|
BABASHKA_LEIN_PROFILES+=",-feature/xml"
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
@ -69,11 +69,11 @@
|
||||||
;; not supported: {:name "setURLStreamHandlerFactory"}
|
;; not supported: {:name "setURLStreamHandlerFactory"}
|
||||||
{:name "toExternalForm"}
|
{:name "toExternalForm"}
|
||||||
{:name "toString"}
|
{:name "toString"}
|
||||||
{:name "toURI"}]}
|
{:name "toURI"}]}}
|
||||||
com.sun.xml.internal.stream.XMLInputFactoryImpl
|
features/xml? (assoc `com.sun.xml.internal.stream.XMLInputFactoryImpl
|
||||||
{:methods [{:name "<init>" :parameterTypes []}]}
|
{:methods [{:name "<init>" :parameterTypes []}]}
|
||||||
com.sun.xml.internal.stream.XMLOutputFactoryImpl
|
`com.sun.xml.internal.stream.XMLOutputFactoryImpl
|
||||||
{:methods [{:name "<init>" :parameterTypes []}]}}
|
{:methods [{:name "<init>" :parameterTypes []}]})
|
||||||
features/hsqldb? (assoc `org.hsqldb.dbinfo.DatabaseInformationFull
|
features/hsqldb? (assoc `org.hsqldb.dbinfo.DatabaseInformationFull
|
||||||
{:methods [{:name "<init>"
|
{:methods [{:name "<init>"
|
||||||
:parameterTypes ["org.hsqldb.Database"]}]}
|
:parameterTypes ["org.hsqldb.Database"]}]}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
(ns babashka.impl.features
|
(ns babashka.impl.features
|
||||||
{:no-doc true})
|
{:no-doc true})
|
||||||
|
|
||||||
(def hsqldb? (= "true" (System/getenv "BABASHKA_FEATURE_HSQLDB")))
|
(def xml? (not= "false" (System/getenv "BABASHKA_FEATURE_XML"))) ;; included by default
|
||||||
|
(def hsqldb? (= "true" (System/getenv "BABASHKA_FEATURE_HSQLDB"))) ;; excluded by default
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
[babashka.impl.common :as common]
|
[babashka.impl.common :as common]
|
||||||
[babashka.impl.csv :as csv]
|
[babashka.impl.csv :as csv]
|
||||||
[babashka.impl.curl :refer [curl-namespace]]
|
[babashka.impl.curl :refer [curl-namespace]]
|
||||||
|
[babashka.impl.features :as features]
|
||||||
[babashka.impl.jdbc :as jdbc]
|
[babashka.impl.jdbc :as jdbc]
|
||||||
[babashka.impl.nrepl-server :as nrepl-server]
|
[babashka.impl.nrepl-server :as nrepl-server]
|
||||||
[babashka.impl.pipe-signal-handler :refer [handle-pipe! pipe-signal-received?]]
|
[babashka.impl.pipe-signal-handler :refer [handle-pipe! pipe-signal-received?]]
|
||||||
|
|
@ -24,7 +25,6 @@
|
||||||
[babashka.impl.test :as t]
|
[babashka.impl.test :as t]
|
||||||
[babashka.impl.tools.cli :refer [tools-cli-namespace]]
|
[babashka.impl.tools.cli :refer [tools-cli-namespace]]
|
||||||
[babashka.impl.transit :refer [transit-namespace]]
|
[babashka.impl.transit :refer [transit-namespace]]
|
||||||
[babashka.impl.xml :as xml]
|
|
||||||
[babashka.impl.yaml :refer [yaml-namespace]]
|
[babashka.impl.yaml :refer [yaml-namespace]]
|
||||||
[babashka.wait :as wait]
|
[babashka.wait :as wait]
|
||||||
[clojure.edn :as edn]
|
[clojure.edn :as edn]
|
||||||
|
|
@ -39,6 +39,9 @@
|
||||||
[sci.impl.vars :as vars])
|
[sci.impl.vars :as vars])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
|
(when features/xml?
|
||||||
|
(require '[babashka.impl.xml]))
|
||||||
|
|
||||||
(binding [*unrestricted* true]
|
(binding [*unrestricted* true]
|
||||||
(sci/alter-var-root sci/in (constantly *in*))
|
(sci/alter-var-root sci/in (constantly *in*))
|
||||||
(sci/alter-var-root sci/out (constantly *out*))
|
(sci/alter-var-root sci/out (constantly *out*))
|
||||||
|
|
@ -245,21 +248,22 @@ Everything after that is bound to *command-line-args*."))
|
||||||
(throw (ex-info "" {:bb/exit-code n})))
|
(throw (ex-info "" {:bb/exit-code n})))
|
||||||
|
|
||||||
(def aliases
|
(def aliases
|
||||||
'{tools.cli clojure.tools.cli
|
(cond->
|
||||||
edn clojure.edn
|
'{tools.cli clojure.tools.cli
|
||||||
wait babashka.wait
|
edn clojure.edn
|
||||||
signal babashka.signal
|
wait babashka.wait
|
||||||
shell clojure.java.shell
|
signal babashka.signal
|
||||||
io clojure.java.io
|
shell clojure.java.shell
|
||||||
async clojure.core.async
|
io clojure.java.io
|
||||||
csv clojure.data.csv
|
async clojure.core.async
|
||||||
json cheshire.core
|
csv clojure.data.csv
|
||||||
xml clojure.data.xml
|
json cheshire.core
|
||||||
yaml clj-yaml.core
|
yaml clj-yaml.core
|
||||||
curl babashka.curl
|
curl babashka.curl
|
||||||
transit cognitect.transit
|
transit cognitect.transit
|
||||||
bencode bencode.core
|
bencode bencode.core
|
||||||
jdbc next.jdbc})
|
jdbc next.jdbc}
|
||||||
|
features/xml? (assoc 'xml 'clojure.data.xml)))
|
||||||
|
|
||||||
(def cp-state (atom nil))
|
(def cp-state (atom nil))
|
||||||
|
|
||||||
|
|
@ -274,29 +278,30 @@ Everything after that is bound to *command-line-args*."))
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
(def namespaces
|
(def namespaces
|
||||||
{'clojure.tools.cli tools-cli-namespace
|
(cond->
|
||||||
'clojure.java.shell shell-namespace
|
{'clojure.tools.cli tools-cli-namespace
|
||||||
'babashka.wait {'wait-for-port wait/wait-for-port
|
'clojure.java.shell shell-namespace
|
||||||
'wait-for-path wait/wait-for-path}
|
'babashka.wait {'wait-for-port wait/wait-for-port
|
||||||
'babashka.signal {'pipe-signal-received? pipe-signal-received?}
|
'wait-for-path wait/wait-for-path}
|
||||||
'clojure.java.io io-namespace
|
'babashka.signal {'pipe-signal-received? pipe-signal-received?}
|
||||||
'clojure.core.async async-namespace
|
'clojure.java.io io-namespace
|
||||||
'clojure.core.async.impl.protocols async-protocols-namespace
|
'clojure.core.async async-namespace
|
||||||
'clojure.data.csv csv/csv-namespace
|
'clojure.core.async.impl.protocols async-protocols-namespace
|
||||||
'cheshire.core cheshire-core-namespace
|
'clojure.data.csv csv/csv-namespace
|
||||||
'clojure.stacktrace stacktrace-namespace
|
'cheshire.core cheshire-core-namespace
|
||||||
'clojure.main {'demunge demunge
|
'clojure.stacktrace stacktrace-namespace
|
||||||
'repl-requires clojure-main/repl-requires}
|
'clojure.main {'demunge demunge
|
||||||
'clojure.test t/clojure-test-namespace
|
'repl-requires clojure-main/repl-requires}
|
||||||
'babashka.classpath {'add-classpath add-classpath*}
|
'clojure.test t/clojure-test-namespace
|
||||||
'clojure.data.xml xml/xml-namespace
|
'babashka.classpath {'add-classpath add-classpath*}
|
||||||
'clj-yaml.core yaml-namespace
|
'clj-yaml.core yaml-namespace
|
||||||
'clojure.pprint pprint-namespace
|
'clojure.pprint pprint-namespace
|
||||||
'babashka.curl curl-namespace
|
'babashka.curl curl-namespace
|
||||||
'cognitect.transit transit-namespace
|
'cognitect.transit transit-namespace
|
||||||
'bencode.core bencode-namespace
|
'bencode.core bencode-namespace
|
||||||
'next.jdbc jdbc/njdbc-namespace
|
'next.jdbc jdbc/njdbc-namespace
|
||||||
'next.jdbc.sql jdbc/next-sql-namespace})
|
'next.jdbc.sql jdbc/next-sql-namespace}
|
||||||
|
features/xml? (assoc 'clojure.data.xml @(resolve 'babashka.impl.xml/xml-namespace))))
|
||||||
|
|
||||||
(def bindings
|
(def bindings
|
||||||
{'java.lang.System/exit exit ;; override exit, so we have more control
|
{'java.lang.System/exit exit ;; override exit, so we have more control
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue