#!/usr/bin/env bash # Builds the GraalVM native image of the same service (no reflection tricks: the app has none). Takes minutes. source "$(dirname "$0")/env.sh" cd "$ROOT"; mkdir -p "$WORK" t0=$(date +%s) JAVA_HOME=$GRAALVM mvn_run mvn -B -DskipTests -Pnative native:compile > "$WORK/native-build.log" 2>&1 rc=$? echo "# GraalVM: $("$GRAALVM/bin/native-image" --version 2>&1 | head -1)" grep -E "types, .* fields, and .* methods found reachable|Peak RSS|Finished generating|BUILD (SUCCESS|FAILURE)|Total time" "$WORK/native-build.log" | sed -E 's/^\[INFO\] //; s/^ +//' [ $rc -eq 0 ] && cp "target/aot-cache" "$WORK/aot-cache-native" && ls -l "$WORK/aot-cache-native" "$WORK/app.jar" | awk '{printf "%-30s %d MB\n", $NF, $5/1048576}' echo "build wall time: $(( $(date +%s) - t0 )) s"