feature/manual_and_auto_classpath_option #1

Merged
David merged 10 commits from feature/manual_and_auto_classpath_option into master 2022-08-12 18:40:10 +02:00
2 changed files with 13 additions and 12 deletions
Showing only changes of commit 9255ff9f33 - Show all commits

View File

@ -63,8 +63,8 @@ Turn JAR (java archive) into self-contained executable
Options:
-j, --java-version <version>
override JDK/JRE version
examples: "11", "11.0", "11.0.2", "11.0.2+9"
(default: 11)
examples: "17", "17.0", "17.0.2", "17.0.2+9"
(default: 17)
-cp, --class-path <classpath>
adds additional classpaths to the jdeps call
-o, --output <directory>
@ -104,6 +104,7 @@ Options:
Tested on the following operating systems:
- Debian 10.8
- Ubuntu 18.04
- macOS Mojave
- Windows Subsystem for Linux with Ubuntu 14.04

20
warp4j
View File

@ -9,8 +9,8 @@ function print_help {
echo 'Options:'
echo ' -j, --java-version <version>'
echo ' override JDK/JRE version'
echo ' examples: "11", "11.0", "11.0.2", "11.0.2+9"'
echo ' (default: 11)'
echo ' examples: "17", "17.0", "17.0.2", "17.0.2+9"'
echo ' (default: 17)'
echo ' -cp, --class-path <classpath>'
echo ' adds additional classpaths to the jdeps call'
echo ' -o, --output <directory>'
@ -235,7 +235,7 @@ if [[ $JVM_IMPL ]] &&
fail_with "jvm implementation \"$JVM_IMPL\" is not correct"
fi
LATEST_LTS=11 # latest LTS java branch
LATEST_LTS=17 # latest LTS java branch
# default options
test -z $JAVA_VERSION && JAVA_VERSION=$LATEST_LTS
@ -640,16 +640,16 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then
# 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)
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" ]
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)
echo "Extracting jar file to get classpath"
unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}"
echo "Fetching modules"
MODULES=$($JDEPS --ignore-missing-deps --print-module-deps --recursive --multi-release $JAVA_VERSION_BASE -quiet --class-path=${EXTRACTED_JAR_PATH}/BOOT-INF/lib/* --module-path=${EXTRACTED_JAR_PATH}/BOOT-INF/lib/BOOT-INF/lib/* $JAR | grep -v Warning)
else
echo "Fetch modules with default behavior"
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