-
Notifications
You must be signed in to change notification settings - Fork 3
/
compile.sh
executable file
·51 lines (42 loc) · 1.33 KB
/
compile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
ARTIFACT=webflux-actuator-graalvm
MAINCLASS=com.example.actuator.ActuatorApplication
VERSION=0.0.1-SNAPSHOT
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
rm -rf target
mkdir -p target/native-image
echo "Packaging $ARTIFACT with Maven"
mvn -ntp package > target/native-image/output.txt
JAR="$ARTIFACT-$VERSION.jar"
echo "Unpacking $JAR"
cd target/native-image
jar -xvf ../$JAR >/dev/null 2>&1
cp -R META-INF BOOT-INF/classes
LIBPATH=`find BOOT-INF/lib | tr '\n' ':'`
CP=BOOT-INF/classes:$LIBPATH
GRAALVM_VERSION=`native-image --version`
echo "Compiling $ARTIFACT with $GRAALVM_VERSION"
{ time native-image \
--verbose \
-H:Name=$ARTIFACT \
-Dspring.spel.ignore=true \
-Dspring.native.factories.no-actuator-metrics=true \
-Dspring.native.build-time-properties-checks=default-include-all \
-Dspring.native.remove-yaml-support=true \
-cp $CP $MAINCLASS >> output.txt ; } 2>> output.txt
# -Dspring.native.build-time-properties-match-if-missing=false \
# -Dspring.native.build-time-properties-checks=default-include-all \
# -Dspring.native.ignore-types=io.micrometer.core. \
# -Dspring.native.verbose=true \
if [[ -f $ARTIFACT ]]
then
printf "${GREEN}SUCCESS${NC}\n"
mv ./$ARTIFACT ..
exit 0
else
cat output.txt
printf "${RED}FAILURE${NC}: an error occurred when compiling the native-image.\n"
exit 1
fi