Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added script to build native using graalvm
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Compiles a standalone stencil application to a native executable using GraalVM. | ||
|
||
set -e | ||
|
||
# cd to script dir | ||
cd "$(dirname "$0")" | ||
|
||
# check if native-image command is available | ||
hash native-image 2>/dev/null || { echo >&2 "Missing native-image command. Aborting."; exit 1; } | ||
|
||
# check if strip command is available | ||
hash strip 2>/dev/null || { echo >&2 "Missing strip command. Aborting."; exit 2; } | ||
|
||
# check if uberjar has been compiled so far | ||
TARGET_JAR=$(echo target/*-standalone.jar) | ||
|
||
if [ ! -f "$TARGET_JAR" ] | ||
then | ||
echo "Stencil standalone is not compiled. Compile it first!" | ||
exit 4 | ||
fi | ||
|
||
OUTPUT=stencil-native | ||
|
||
# build it | ||
native-image \ | ||
-jar $TARGET_JAR \ | ||
-H:ReflectionConfigurationFiles=./reflectconfig \ | ||
-H:IncludeResources='.*.txt$' \ | ||
--report-unsupported-elements-at-runtime \ | ||
$OUTPUT | ||
|
||
# remove unused symbols and sections | ||
strip $OUTPUT | ||
|
||
echo "Generated $OUTPUT file!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"name" : "com.sun.xml.internal.stream.XMLInputFactoryImpl", | ||
"methods" : [ | ||
{ "name" : "<init>", "parameterTypes" : [] } | ||
] | ||
}, | ||
{ | ||
"name" : "com.sun.xml.internal.stream.XMLOutputFactoryImpl", | ||
"methods" : [ | ||
{ "name" : "<init>", "parameterTypes" : [] } | ||
] | ||
} | ||
] |