[#389] feature flag for java.time

This commit is contained in:
Michiel Borkent 2020-04-30 12:39:44 +02:00
parent 6f14479749
commit 2a44b9f9dd
4 changed files with 52 additions and 48 deletions

View file

@ -21,37 +21,36 @@ then
exit 1
fi
$GRAALVM_HOME/bin/gu install native-image
"$GRAALVM_HOME/bin/gu" install native-image
export JAVA_HOME=$GRAALVM_HOME
SVM_JAR=$(find "$GRAALVM_HOME" | grep svm.jar)
$GRAALVM_HOME/bin/javac -cp "$SVM_JAR" resources/CutOffCoreServicesDependencies.java
"$GRAALVM_HOME/bin/javac" -cp "$SVM_JAR" resources/CutOffCoreServicesDependencies.java
BABASHKA_FEATURE_HSQLDB=${BABASHKA_FEATURE_HSQLDB:-}
BABASHKA_BINARY=${BABASHKA_BINARY:-"bb"}
args=( -jar $BABASHKA_JAR \
-H:Name=$BABASHKA_BINARY \
-H:+ReportExceptionStackTraces \
-J-Dclojure.spec.skip-macros=true \
-J-Dclojure.compiler.direct-linking=true \
"-H:IncludeResources=BABASHKA_VERSION" \
"-H:IncludeResources=SCI_VERSION" \
-H:ReflectionConfigurationFiles=reflection.json \
--initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \
--initialize-at-build-time \
-H:Log=registerResource: \
-H:EnableURLProtocols=http,https \
--enable-all-security-services \
-H:+JNI \
--verbose \
--no-fallback \
--no-server \
--report-unsupported-elements-at-runtime \
"--initialize-at-run-time=org.postgresql.sspi.SSPIClient" \
args=( "-jar" "$BABASHKA_JAR"
"-H:Name=$BABASHKA_BINARY"
"-H:+ReportExceptionStackTraces"
"-J-Dclojure.spec.skip-macros=true"
"-J-Dclojure.compiler.direct-linking=true"
"-H:IncludeResources=BABASHKA_VERSION"
"-H:IncludeResources=SCI_VERSION"
"-H:ReflectionConfigurationFiles=reflection.json"
"--initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder"
"--initialize-at-build-time"
"-H:Log=registerResource:"
"-H:EnableURLProtocols=http,https"
"--enable-all-security-services"
"-H:+JNI"
"--verbose"
"--no-fallback"
"--no-server"
"--report-unsupported-elements-at-runtime"
"--initialize-at-run-time=org.postgresql.sspi.SSPIClient"
"$BABASHKA_XMX" )
BABASHKA_STATIC=${BABASHKA_STATIC:-}
@ -63,9 +62,11 @@ fi
BABASHKA_FEATURE_HSQLDB=${BABASHKA_FEATURE_HSQLDB:-}
if [ "$BABASHKA_FEATURE_HSQLDB" = "true" ]; then
args+=("-H:IncludeResources=org/hsqldb/.*\.properties", "-H:IncludeResources=org/hsqldb/.*\.sql")
args+=("-H:IncludeResources=org/hsqldb/.*\.properties" "-H:IncludeResources=org/hsqldb/.*\.sql")
fi
BABASHKA_LEAN=${BABASHKA_LEAN:-}
if [ "$BABASHKA_LEAN" = "true" ]
then
export BABASHKA_FEATURE_JDBC=false
@ -78,4 +79,4 @@ then
export BABAHSKA_FEATURE_TRANSIT=false
fi
$GRAALVM_HOME/bin/native-image "${args[@]}"
"$GRAALVM_HOME/bin/native-image" "${args[@]}"

View file

@ -12,6 +12,7 @@ then
export BABASHKA_FEATURE_CORE_ASYNC=false
export BABASHKA_FEATURE_CSV=false
export BABAHSKA_FEATURE_TRANSIT=false
export BABAHSKA_FEATURE_JAVA_TIME=false
fi
BABASHKA_LEIN_PROFILES="+uberjar"

View file

@ -151,7 +151,8 @@
java.nio.file.attribute.PosixFilePermission
java.nio.file.attribute.PosixFilePermissions
java.security.MessageDigest
java.time.format.DateTimeFormatter
~@(when features/java-time?
'[java.time.format.DateTimeFormatter
java.time.Clock
java.time.DateTimeException
java.time.DayOfWeek
@ -171,7 +172,7 @@
java.time.ZoneId
java.time.ZoneOffset
java.time.temporal.ChronoUnit
java.time.temporal.TemporalAccessor
java.time.temporal.TemporalAccessor])
java.util.regex.Pattern
java.util.Base64
java.util.Base64$Decoder
@ -186,8 +187,8 @@
java.util.zip.GZIPInputStream
java.util.zip.GZIPOutputStream
~(symbol "[B")
~@(when features/yaml? [`org.yaml.snakeyaml.error.YAMLException])
~@(when features/hsqldb? [`org.hsqldb.jdbcDriver])]
~@(when features/yaml? '[org.yaml.snakeyaml.error.YAMLException])
~@(when features/hsqldb? '[org.hsqldb.jdbcDriver])]
:constructors [clojure.lang.Delay
clojure.lang.MapEntry
clojure.lang.LineNumberingPushbackReader

View file

@ -7,6 +7,7 @@
(def core-async? (not= "false" (System/getenv "BABASHKA_FEATURE_CORE_ASYNC")))
(def csv? (not= "false" (System/getenv "BABASHKA_FEATURE_CSV")))
(def transit? (not= "false" (System/getenv "BABASHKA_FEATURE_TRANSIT")))
(def java-time? (not= "false" (System/getenv "BABASHKA_FEATURE_JAVA_TIME")))
;; excluded by default
(def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC")))