Compare commits

...

3 Commits

46
warp4j
View File

@ -15,10 +15,17 @@ function print_help {
echo ' adds additional classpaths to the jdeps call' echo ' adds additional classpaths to the jdeps call'
echo ' --auto-class-path extract and get class-path values from jar file' echo ' --auto-class-path extract and get class-path values from jar file'
echo ' ignored when -cp, --class-path is set' echo ' ignored when -cp, --class-path is set'
echo ' --spring-boot extract and get class-path values from'
echo ' Spring-Boot application jar file'
echo ' ignored when -cp, --class-path is set'
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'
echo ' (default: ./warped)' echo ' (default: ./warped)'
echo ' -p, --prefix <prefix>'
echo ' if set, warp-packer will use the prefix'
echo ' as target folder in which the '
echo ' application should be extracted'
echo ' --list show available java releases;' echo ' --list show available java releases;'
echo ' takes into consideration other options:' echo ' takes into consideration other options:'
echo ' "--java-version", "--no-optimize", "--jvm-impl";' echo ' "--java-version", "--no-optimize", "--jvm-impl";'
@ -128,6 +135,14 @@ while [[ $# -gt 0 ]]; do
CLASS_PATH="$2" CLASS_PATH="$2"
shift 2 shift 2
;; ;;
--auto-class-path)
AUTO_CLASS_PATH=true
shift
;;
--spring-boot)
SPRING_BOOT_APPLICATION=true
shift
;;
-j|--java-version) -j|--java-version)
JAVA_VERSION="$2" JAVA_VERSION="$2"
JAVA_VERSION_OVERRIDEN=true JAVA_VERSION_OVERRIDEN=true
@ -137,6 +152,10 @@ while [[ $# -gt 0 ]]; do
OUTPUT_DIR_PATH="$2" OUTPUT_DIR_PATH="$2"
shift 2 shift 2
;; ;;
-p|--prefix)
PREFIX="--prefix $2"
shift 2
;;
--list) --list)
LIST_RELEASES=true LIST_RELEASES=true
shift shift
@ -165,10 +184,6 @@ while [[ $# -gt 0 ]]; do
JVM_OPTIONS="$2" JVM_OPTIONS="$2"
shift 2 shift 2
;; ;;
--auto-class-path)
AUTO_CLASS_PATH=true
shift
;;
-s|--silent) -s|--silent)
SILENT=true SILENT=true
shift shift
@ -559,7 +574,7 @@ function ensure_distro_cached() {
distro_link=$(find_distro_link "$distro_info" $CONCRETE_JAVA_VERSION) distro_link=$(find_distro_link "$distro_info" $CONCRETE_JAVA_VERSION)
download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link" download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link"
else else
CONCRETE_JAVA_VERSION=$(find_latest_cached $architecture $platform $JAVA_VERSION) CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $JAVA_VERSION)
fi fi
fi fi
else else
@ -671,6 +686,12 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then
unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}" unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}"
echo "Fetching modules" echo "Fetching modules"
MODULES=$($JDEPS --ignore-missing-deps --print-module-deps --recursive --multi-release $JAVA_VERSION_BASE -quiet --class-path=${EXTRACTED_JAR_PATH}/* --module-path=${EXTRACTED_JAR_PATH}/* $JAR | grep -v Warning) MODULES=$($JDEPS --ignore-missing-deps --print-module-deps --recursive --multi-release $JAVA_VERSION_BASE -quiet --class-path=${EXTRACTED_JAR_PATH}/* --module-path=${EXTRACTED_JAR_PATH}/* $JAR | grep -v Warning)
elif [ "$SPRING_BOOT_APPLICATION" ]
then
echo "Extracting Spring Boot 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 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) MODULES=$("$JDEPS" --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE "$JAR" | grep -v Warning)
@ -742,8 +763,11 @@ function warp_targets() {
echo "Warping for $LIN..." echo "Warping for $LIN..."
mkdir -p "$WARPED_TEMP_PATH/$LIN" mkdir -p "$WARPED_TEMP_PATH/$LIN"
warp-packer \ warp-packer \
pack \
--unique-id \
$PREFIX \
--arch linux-x64 \ --arch linux-x64 \
--input_dir "$BUNDLES_PATH/$LIN" \ --input-dir "$BUNDLES_PATH/$LIN" \
--exec "$LAUNCHER_NAME.sh" \ --exec "$LAUNCHER_NAME.sh" \
--output "$WARPED_TEMP_PATH/$LIN/$APP_NAME" \ --output "$WARPED_TEMP_PATH/$LIN/$APP_NAME" \
&> /dev/null &> /dev/null
@ -760,8 +784,11 @@ function warp_targets() {
echo "Warping for $MAC..." echo "Warping for $MAC..."
mkdir -p "$WARPED_TEMP_PATH/$MAC" mkdir -p "$WARPED_TEMP_PATH/$MAC"
warp-packer \ warp-packer \
pack \
--unique-id \
$PREFIX \
--arch macos-x64 \ --arch macos-x64 \
--input_dir "$BUNDLES_PATH/$MAC" \ --input-dir "$BUNDLES_PATH/$MAC" \
--exec "$LAUNCHER_NAME.sh" \ --exec "$LAUNCHER_NAME.sh" \
--output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \
&> /dev/null &> /dev/null
@ -778,8 +805,11 @@ function warp_targets() {
echo "Warping for $WIN..." echo "Warping for $WIN..."
mkdir -p "$WARPED_TEMP_PATH/$WIN" mkdir -p "$WARPED_TEMP_PATH/$WIN"
warp-packer \ warp-packer \
pack \
--unique-id \
$PREFIX \
--arch windows-x64 \ --arch windows-x64 \
--input_dir "$BUNDLES_PATH/$WIN" \ --input-dir "$BUNDLES_PATH/$WIN" \
--exec "$LAUNCHER_NAME.cmd" \ --exec "$LAUNCHER_NAME.cmd" \
--output "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" \ --output "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" \
&> /dev/null &> /dev/null