babashka: sync native-image arguments with upstream
This commit syncs the arguments passed to the babashka with upstream: https://github.com/babashka/babashka/blob/77daea7362d8e2562c89c315b1fbcefde6fa56a5/script/compile#L41-L74 The idea here is to enable more features and reduce the number of issues compared to upstream. Also add some tests to ensure everything is working.
This commit is contained in:
@@ -17,36 +17,71 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
|
|
||||||
LC_ALL = "en_US.UTF-8";
|
|
||||||
nativeBuildInputs = [ graalvm11-ce glibcLocales ];
|
nativeBuildInputs = [ graalvm11-ce glibcLocales ];
|
||||||
|
|
||||||
|
LC_ALL = "en_US.UTF-8";
|
||||||
|
BABASHKA_JAR = src;
|
||||||
|
BABASHKA_BINARY = "bb";
|
||||||
|
BABASHKA_XMX = "-J-Xmx4500m";
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
native-image \
|
runHook preBuild
|
||||||
-jar ${src} \
|
|
||||||
-H:Name=bb \
|
# https://github.com/babashka/babashka/blob/77daea7362d8e2562c89c315b1fbcefde6fa56a5/script/compile
|
||||||
${lib.optionalString stdenv.isDarwin ''-H:-CheckToolchain''} \
|
args=("-jar" "$BABASHKA_JAR"
|
||||||
-H:+ReportExceptionStackTraces \
|
"-H:Name=$BABASHKA_BINARY"
|
||||||
-J-Dclojure.spec.skip-macros=true \
|
"${lib.optionalString stdenv.isDarwin ''-H:-CheckToolchain''}"
|
||||||
-J-Dclojure.compiler.direct-linking=true \
|
"-H:+ReportExceptionStackTraces"
|
||||||
"-H:IncludeResources=BABASHKA_VERSION" \
|
"-J-Dclojure.spec.skip-macros=true"
|
||||||
"-H:IncludeResources=SCI_VERSION" \
|
"-J-Dclojure.compiler.direct-linking=true"
|
||||||
-H:ReflectionConfigurationFiles=${reflectionJson} \
|
"-H:IncludeResources=BABASHKA_VERSION"
|
||||||
--initialize-at-build-time \
|
"-H:IncludeResources=SCI_VERSION"
|
||||||
-H:Log=registerResource: \
|
"-H:ReflectionConfigurationFiles=${reflectionJson}"
|
||||||
-H:EnableURLProtocols=http,https \
|
"--initialize-at-build-time"
|
||||||
--enable-all-security-services \
|
# "-H:+PrintAnalysisCallTree"
|
||||||
-H:+JNI \
|
# "-H:+DashboardAll"
|
||||||
--verbose \
|
# "-H:DashboardDump=reports/dump"
|
||||||
--no-fallback \
|
# "-H:+DashboardPretty"
|
||||||
--no-server \
|
# "-H:+DashboardJson"
|
||||||
--report-unsupported-elements-at-runtime \
|
"-H:Log=registerResource:"
|
||||||
"--initialize-at-run-time=org.postgresql.sspi.SSPIClient" \
|
"-H:EnableURLProtocols=http,https,jar"
|
||||||
"-J-Xmx4500m"
|
"--enable-all-security-services"
|
||||||
|
"-H:+JNI"
|
||||||
|
"--verbose"
|
||||||
|
"--no-fallback"
|
||||||
|
"--no-server"
|
||||||
|
"--report-unsupported-elements-at-runtime"
|
||||||
|
"--initialize-at-run-time=org.postgresql.sspi.SSPIClient"
|
||||||
|
"--native-image-info"
|
||||||
|
"--verbose"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.AudioFileReader"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiFileReader"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.MixerProvider"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.FormatConversionProvider"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.AudioFileWriter"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiDeviceProvider"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.SoundbankReader"
|
||||||
|
"-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiFileWriter"
|
||||||
|
"$BABASHKA_XMX")
|
||||||
|
|
||||||
|
native-image ''${args[@]}
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp bb $out/bin/bb
|
cp bb $out/bin/bb
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
installCheckPhase = ''
|
||||||
|
$out/bin/bb --version | grep '${version}'
|
||||||
|
$out/bin/bb '(+ 1 2)' | grep '3'
|
||||||
|
$out/bin/bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]' | grep '[1 2]'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|||||||
Reference in New Issue
Block a user