feature/manual_and_auto_classpath_option #1
27
warp4j
27
warp4j
@ -13,6 +13,8 @@ function print_help {
|
||||
echo ' (default: 17)'
|
||||
echo ' -cp, --class-path <classpath>'
|
||||
echo ' adds additional classpaths to the jdeps call'
|
||||
echo ' --auto-class-path extract and get class-path values from jar file'
|
||||
echo ' ignored when -cp, --class-path is set'
|
||||
echo ' -o, --output <directory>'
|
||||
echo ' override output directory;'
|
||||
echo ' this is relative to current PWD'
|
||||
@ -29,7 +31,6 @@ function print_help {
|
||||
echo ' --pull check if more recent JDK/JRE distro is available;'
|
||||
echo ' by default latest cached version that matches'
|
||||
echo ' "--java-version" is used'
|
||||
echo ' --spring-boot extract from (Spring-Boot) jar the dependencies'
|
||||
echo ' to get the classpath for jdeps call'
|
||||
echo ' --linux create binary for Linux'
|
||||
echo ' --macos create binary for macOS'
|
||||
@ -43,6 +44,7 @@ function print_help {
|
||||
echo ' "java <options> -jar <jar file>";'
|
||||
echo ' use quotes when passing multiple options'
|
||||
echo " example: '-Xms512m -Xmx1024m'"
|
||||
echo ' -s, --silent using javaw instead of java for windows'
|
||||
echo ' -h, --help show this message'
|
||||
exit
|
||||
}
|
||||
@ -153,8 +155,12 @@ while [[ $# -gt 0 ]]; do
|
||||
JVM_OPTIONS="$2"
|
||||
shift 2
|
||||
;;
|
||||
--spring-boot)
|
||||
SPRING_BOOT=true
|
||||
--auto-class-path)
|
||||
AUTO_CLASS_PATH=true
|
||||
shift
|
||||
;;
|
||||
-s|--silent)
|
||||
SILENT=true
|
||||
shift
|
||||
;;
|
||||
-*|--*) # unsupported options
|
||||
@ -381,7 +387,7 @@ fi
|
||||
JAVA_DOWNLOAD_PATH=$CACHE_PATH/$JAVA_DISTRO_TYPE/$JVM_IMPL
|
||||
BUNDLES_PATH=$CACHE_PATH/bundle # prepare bundles here
|
||||
|
||||
# path for extracted jar (Spring-Boot) files
|
||||
# path for extracted jar files
|
||||
EXTRACTED_JAR_PATH=$CACHE_PATH/app-jar # prepare bundles here
|
||||
mkdir -p ${EXTRACTED_JAR_PATH}
|
||||
trap 'rm -rf ${EXTRACTED_JAR_PATH}' EXIT
|
||||
@ -407,7 +413,7 @@ JAVA_DIST='"$BUNDLED_DISTRO_SUBDIR"'
|
||||
JAR='"$JAR_NAME"'.jar
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" ; pwd -P)"
|
||||
JAVA=$DIR/$JAVA_DIST/bin/java
|
||||
JAVA=$DIR/$JAVA_DIST/bin/'"$JAVA_EXEC"'
|
||||
JAR_PATH=$DIR/$JAR
|
||||
|
||||
exec "$JAVA" '"$JVM_OPTIONS"' -jar "$JAR_PATH" "$@"
|
||||
@ -424,7 +430,7 @@ SETLOCAL
|
||||
SET "JAVA_DIST='"$BUNDLED_DISTRO_SUBDIR"'"
|
||||
SET "JAR='"$JAR_NAME"'.jar"
|
||||
|
||||
SET "JAVA=%~dp0\%JAVA_DIST%\bin\java.exe"
|
||||
SET "JAVA=%~dp0\%JAVA_DIST%\bin\'"$JAVA_EXEC"'
|
||||
SET "JAR_PATH=%~dp0\%JAR%"
|
||||
|
||||
START %JAVA% '"$JVM_OPTIONS"' -jar %JAR_PATH% %*
|
||||
@ -642,7 +648,7 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then
|
||||
then
|
||||
echo "Using given classpaths: $CLASS_PATH"
|
||||
MODULES=$($JDEPS --class-path=$CLASS_PATH --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE $JAR | grep -v Warning)
|
||||
elif [ "$SPRING_BOOT" ]
|
||||
elif [ "$AUTO_CLASS_PATH" ]
|
||||
then
|
||||
echo "Extracting jar file to get classpath"
|
||||
unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}"
|
||||
@ -672,6 +678,13 @@ function create_optimized_runtime() {
|
||||
# creates warp bundle for the platform
|
||||
function create_bundle() {
|
||||
local platform=$1
|
||||
|
||||
if [[ $SILENT ]] && [[ $platform == $WIN ]]; then
|
||||
JAVA_EXEC=javaw
|
||||
else
|
||||
JAVA_EXEC=java
|
||||
fi
|
||||
|
||||
case $JAVA_DISTRO_TYPE in
|
||||
$DISTRO_TYPE_JDK)
|
||||
create_optimized_runtime $platform
|
||||
|
Loading…
Reference in New Issue
Block a user