diff --git a/script/compile b/script/compile index 11988818..79177224 100755 --- a/script/compile +++ b/script/compile @@ -21,38 +21,37 @@ 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" \ - "$BABASHKA_XMX" ) +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[@]}" diff --git a/script/uberjar b/script/uberjar index 2a41fef5..f7c77e1d 100755 --- a/script/uberjar +++ b/script/uberjar @@ -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" diff --git a/src/babashka/impl/classes.clj b/src/babashka/impl/classes.clj index 964b9144..6a624d68 100644 --- a/src/babashka/impl/classes.clj +++ b/src/babashka/impl/classes.clj @@ -151,27 +151,28 @@ java.nio.file.attribute.PosixFilePermission java.nio.file.attribute.PosixFilePermissions java.security.MessageDigest - java.time.format.DateTimeFormatter - java.time.Clock - java.time.DateTimeException - java.time.DayOfWeek - java.time.Duration - java.time.Instant - java.time.LocalDate - java.time.LocalDateTime - java.time.LocalTime - java.time.Month - java.time.MonthDay - java.time.OffsetDateTime - java.time.OffsetTime - java.time.Period - java.time.Year - java.time.YearMonth - java.time.ZonedDateTime - java.time.ZoneId - java.time.ZoneOffset - java.time.temporal.ChronoUnit - java.time.temporal.TemporalAccessor + ~@(when features/java-time? + '[java.time.format.DateTimeFormatter + java.time.Clock + java.time.DateTimeException + java.time.DayOfWeek + java.time.Duration + java.time.Instant + java.time.LocalDate + java.time.LocalDateTime + java.time.LocalTime + java.time.Month + java.time.MonthDay + java.time.OffsetDateTime + java.time.OffsetTime + java.time.Period + java.time.Year + java.time.YearMonth + java.time.ZonedDateTime + java.time.ZoneId + java.time.ZoneOffset + java.time.temporal.ChronoUnit + 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 diff --git a/src/babashka/impl/features.clj b/src/babashka/impl/features.clj index 7abaf507..88b15581 100644 --- a/src/babashka/impl/features.clj +++ b/src/babashka/impl/features.clj @@ -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")))