babashka/script/compile

46 lines
1.2 KiB
Text
Raw Normal View History

2019-08-09 12:51:42 +00:00
#!/usr/bin/env bash
2019-08-15 07:02:43 +00:00
set -eo pipefail
2020-01-09 10:11:12 +00:00
if [ -z "$GRAALVM_HOME" ]; then
echo "Please set GRAALVM_HOME"
exit 1
fi
2019-08-09 12:51:42 +00:00
2020-01-09 10:11:12 +00:00
"$GRAALVM_HOME/bin/gu" install native-image || true
2019-08-09 12:51:42 +00:00
BABASHKA_VERSION=$(cat resources/BABASHKA_VERSION)
2019-08-17 10:42:20 +00:00
# # We also need to AOT sci, else something didn't work in the Mac build on CircleCI
# # See https://github.com/oracle/graal/issues/1613
# ( cd /tmp; git clone https://github.com/borkdude/sci 2> /dev/null || true )
# mkdir -p src/sci
# cp -R /tmp/sci/src/* src
2019-08-15 07:02:43 +00:00
2020-01-09 10:11:12 +00:00
export JAVA_HOME=$GRAALVM_HOME
lein with-profiles +reflection do run
2019-08-31 18:17:36 +00:00
lein do clean, uberjar
2020-01-09 10:11:12 +00:00
$GRAALVM_HOME/bin/native-image \
2019-08-09 12:51:42 +00:00
-jar target/babashka-$BABASHKA_VERSION-standalone.jar \
-H:Name=bb \
-H:+ReportExceptionStackTraces \
-J-Dclojure.spec.skip-macros=true \
-J-Dclojure.compiler.direct-linking=true \
"-H:IncludeResources=BABASHKA_VERSION" \
2019-08-13 22:19:15 +00:00
"-H:IncludeResources=SCI_VERSION" \
2019-08-09 12:51:42 +00:00
-H:ReflectionConfigurationFiles=reflection.json \
2019-08-13 22:19:15 +00:00
--initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \
--initialize-at-build-time \
2019-08-09 12:51:42 +00:00
-H:Log=registerResource: \
2019-08-17 15:38:24 +00:00
-H:EnableURLProtocols=http,https \
--enable-all-security-services \
-H:+JNI \
2019-08-09 12:51:42 +00:00
--verbose \
--no-fallback \
--no-server \
"-J-Xmx3g"
lein clean