feature/manual_and_auto_classpath_option #1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
fatjar/
|
fatjar/
|
||||||
warped/
|
warped/
|
||||||
TODO.md
|
TODO.md
|
||||||
|
/.project
|
||||||
|
@ -65,6 +65,8 @@ Options:
|
|||||||
override JDK/JRE version
|
override JDK/JRE version
|
||||||
examples: "11", "11.0", "11.0.2", "11.0.2+9"
|
examples: "11", "11.0", "11.0.2", "11.0.2+9"
|
||||||
(default: 11)
|
(default: 11)
|
||||||
|
-cp, --class-path <classpath>
|
||||||
|
adds additional classpaths to the jdeps call
|
||||||
-o, --output <directory>
|
-o, --output <directory>
|
||||||
override output directory;
|
override output directory;
|
||||||
this is relative to current PWD
|
this is relative to current PWD
|
||||||
@ -81,6 +83,8 @@ Options:
|
|||||||
--pull check if more recent JDK/JRE distro is available;
|
--pull check if more recent JDK/JRE distro is available;
|
||||||
by default latest cached version that matches
|
by default latest cached version that matches
|
||||||
"--java-version" is used
|
"--java-version" is used
|
||||||
|
--spring-boot extract from (Spring-Boot) jar the dependencies'
|
||||||
|
to get the classpath for jdeps call'
|
||||||
--linux create binary for Linux
|
--linux create binary for Linux
|
||||||
--macos create binary for macOS
|
--macos create binary for macOS
|
||||||
--windows create binary for Windows
|
--windows create binary for Windows
|
||||||
|
39
warp4j
39
warp4j
@ -11,6 +11,8 @@ function print_help {
|
|||||||
echo ' override JDK/JRE version'
|
echo ' override JDK/JRE version'
|
||||||
echo ' examples: "11", "11.0", "11.0.2", "11.0.2+9"'
|
echo ' examples: "11", "11.0", "11.0.2", "11.0.2+9"'
|
||||||
echo ' (default: 11)'
|
echo ' (default: 11)'
|
||||||
|
echo ' -cp, --class-path <classpath>'
|
||||||
|
echo ' adds additional classpaths to the jdeps call'
|
||||||
echo ' -o, --output <directory>'
|
echo ' -o, --output <directory>'
|
||||||
echo ' override output directory;'
|
echo ' override output directory;'
|
||||||
echo ' this is relative to current PWD'
|
echo ' this is relative to current PWD'
|
||||||
@ -27,6 +29,8 @@ function print_help {
|
|||||||
echo ' --pull check if more recent JDK/JRE distro is available;'
|
echo ' --pull check if more recent JDK/JRE distro is available;'
|
||||||
echo ' by default latest cached version that matches'
|
echo ' by default latest cached version that matches'
|
||||||
echo ' "--java-version" is used'
|
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 ' --linux create binary for Linux'
|
||||||
echo ' --macos create binary for macOS'
|
echo ' --macos create binary for macOS'
|
||||||
echo ' --windows create binary for Windows'
|
echo ' --windows create binary for Windows'
|
||||||
@ -104,6 +108,10 @@ while [[ $# -gt 0 ]]; do
|
|||||||
print_help
|
print_help
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
-cp|--class-path)
|
||||||
|
CLASS_PATH="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-j|--java-version)
|
-j|--java-version)
|
||||||
JAVA_VERSION="$2"
|
JAVA_VERSION="$2"
|
||||||
JAVA_VERSION_OVERRIDEN=true
|
JAVA_VERSION_OVERRIDEN=true
|
||||||
@ -145,6 +153,10 @@ while [[ $# -gt 0 ]]; do
|
|||||||
JVM_OPTIONS="$2"
|
JVM_OPTIONS="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
--spring-boot)
|
||||||
|
SPRING_BOOT=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-*|--*) # unsupported options
|
-*|--*) # unsupported options
|
||||||
fail_with "Unsupported option $1"
|
fail_with "Unsupported option $1"
|
||||||
;;
|
;;
|
||||||
@ -369,6 +381,11 @@ fi
|
|||||||
JAVA_DOWNLOAD_PATH=$CACHE_PATH/$JAVA_DISTRO_TYPE/$JVM_IMPL
|
JAVA_DOWNLOAD_PATH=$CACHE_PATH/$JAVA_DISTRO_TYPE/$JVM_IMPL
|
||||||
BUNDLES_PATH=$CACHE_PATH/bundle # prepare bundles here
|
BUNDLES_PATH=$CACHE_PATH/bundle # prepare bundles here
|
||||||
|
|
||||||
|
# path for extracted jar (Spring-Boot) files
|
||||||
|
EXTRACTED_JAR_PATH=$CACHE_PATH/app-jar # prepare bundles here
|
||||||
|
mkdir -p ${EXTRACTED_JAR_PATH}
|
||||||
|
trap 'rm -rf ${EXTRACTED_JAR_PATH}' EXIT
|
||||||
|
|
||||||
DIR="$(pwd -P)" # execution directory path
|
DIR="$(pwd -P)" # execution directory path
|
||||||
|
|
||||||
# final binaries created in WARPED_TEMP_PATH and then moved to WARPED_PATH
|
# final binaries created in WARPED_TEMP_PATH and then moved to WARPED_PATH
|
||||||
@ -407,10 +424,10 @@ SETLOCAL
|
|||||||
SET "JAVA_DIST='"$BUNDLED_DISTRO_SUBDIR"'"
|
SET "JAVA_DIST='"$BUNDLED_DISTRO_SUBDIR"'"
|
||||||
SET "JAR='"$JAR_NAME"'.jar"
|
SET "JAR='"$JAR_NAME"'.jar"
|
||||||
|
|
||||||
SET "JAVA=%~dp0\%JAVA_DIST%\bin\java.exe"
|
SET "JAVA=%~dp0\%JAVA_DIST%\bin\javaw.exe"
|
||||||
SET "JAR_PATH=%~dp0\%JAR%"
|
SET "JAR_PATH=%~dp0\%JAR%"
|
||||||
|
|
||||||
CALL %JAVA% '"$JVM_OPTIONS"' -jar %JAR_PATH% %*
|
START %JAVA% '"$JVM_OPTIONS"' -jar %JAR_PATH% %*
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
@ -620,7 +637,21 @@ JDEPS=$JDK_PATH/bin/jdeps
|
|||||||
if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then
|
if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then
|
||||||
echo "Analyzing dependencies..."
|
echo "Analyzing dependencies..."
|
||||||
# TODO check for errors
|
# TODO check for errors
|
||||||
MODULES=$("$JDEPS" --print-module-deps "$JAR" | grep -v Warning)
|
# TODO If JAVA_VERSION is not an INT it will throw an error
|
||||||
|
if [ -n "$CLASS_PATH" ]
|
||||||
|
then
|
||||||
|
echo "Using given classpaths: $CLASS_PATH"
|
||||||
|
MODULES=$("$JDEPS" -cp $CLASS_PATH --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE "$JAR" | grep -v Warning)
|
||||||
|
elif [ "$SPRING_BOOT" ]
|
||||||
|
then
|
||||||
|
echo "Extracting jar file to get classpath"
|
||||||
|
unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}"
|
||||||
|
echo "Fetching modules"
|
||||||
|
MODULES=$("$JDEPS" -classpath \'${EXTRACTED_JAR_PATH}/BOOT-INF/lib/*:${EXTRACTED_JAR_PATH}/BOOT-INF/classes:${EXTRACTED_JAR_PATH}\' --print-module-deps --ignore-missing-deps --module-path ${EXTRACTED_JAR_PATH}/BOOT-INF/lib/javax.activation-api-1.2.0.jar --recursive --multi-release ${JAVA_VERSION_BASE} -quiet ${EXTRACTED_JAR_PATH}/org ${EXTRACTED_JAR_PATH}/BOOT-INF/classes ${EXTRACTED_JAR_PATH}/BOOT-INF/lib/*.jar | grep -v Warning)
|
||||||
|
else
|
||||||
|
echo "Fetch modules with default behavior"
|
||||||
|
MODULES=$("$JDEPS" --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE "$JAR" | grep -v Warning)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# creates minimized runtime for the platform
|
# creates minimized runtime for the platform
|
||||||
@ -734,4 +765,4 @@ function warp_targets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# actually create binaries and archives for all targets
|
# actually create binaries and archives for all targets
|
||||||
warp_targets
|
warp_targets
|
Loading…
Reference in New Issue
Block a user