From a6e57554354e33ecfc2dccb88eb3399f36a4d54f Mon Sep 17 00:00:00 2001 From: david Date: Thu, 16 May 2024 08:31:58 +0200 Subject: [PATCH 1/2] Adding prefix parameter to warp4j --- warp4j | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/warp4j b/warp4j index ce09222..19f788a 100755 --- a/warp4j +++ b/warp4j @@ -19,6 +19,10 @@ function print_help { echo ' override output directory;' echo ' this is relative to current PWD' echo ' (default: ./warped)' + echo ' -p, --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 ' takes into consideration other options:' echo ' "--java-version", "--no-optimize", "--jvm-impl";' @@ -128,6 +132,10 @@ while [[ $# -gt 0 ]]; do CLASS_PATH="$2" shift 2 ;; + --auto-class-path) + AUTO_CLASS_PATH=true + shift + ;; -j|--java-version) JAVA_VERSION="$2" JAVA_VERSION_OVERRIDEN=true @@ -137,6 +145,10 @@ while [[ $# -gt 0 ]]; do OUTPUT_DIR_PATH="$2" shift 2 ;; + -p|--prefix) + PREFIX="--prefix $2" + shift 2 + ;; --list) LIST_RELEASES=true shift @@ -165,10 +177,6 @@ while [[ $# -gt 0 ]]; do JVM_OPTIONS="$2" shift 2 ;; - --auto-class-path) - AUTO_CLASS_PATH=true - shift - ;; -s|--silent) SILENT=true shift @@ -559,7 +567,7 @@ function ensure_distro_cached() { distro_link=$(find_distro_link "$distro_info" $CONCRETE_JAVA_VERSION) download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link" else - CONCRETE_JAVA_VERSION=$(find_latest_cached $architecture $platform $JAVA_VERSION) + CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $JAVA_VERSION) fi fi else @@ -742,8 +750,11 @@ function warp_targets() { echo "Warping for $LIN..." mkdir -p "$WARPED_TEMP_PATH/$LIN" warp-packer \ + pack \ + --unique-id \ + $PREFIX \ --arch linux-x64 \ - --input_dir "$BUNDLES_PATH/$LIN" \ + --input-dir "$BUNDLES_PATH/$LIN" \ --exec "$LAUNCHER_NAME.sh" \ --output "$WARPED_TEMP_PATH/$LIN/$APP_NAME" \ &> /dev/null @@ -760,8 +771,11 @@ function warp_targets() { echo "Warping for $MAC..." mkdir -p "$WARPED_TEMP_PATH/$MAC" warp-packer \ + pack \ + --unique-id \ + $PREFIX \ --arch macos-x64 \ - --input_dir "$BUNDLES_PATH/$MAC" \ + --input-dir "$BUNDLES_PATH/$MAC" \ --exec "$LAUNCHER_NAME.sh" \ --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ &> /dev/null @@ -778,8 +792,11 @@ function warp_targets() { echo "Warping for $WIN..." mkdir -p "$WARPED_TEMP_PATH/$WIN" warp-packer \ + pack \ + --unique-id \ + $PREFIX \ --arch windows-x64 \ - --input_dir "$BUNDLES_PATH/$WIN" \ + --input-dir "$BUNDLES_PATH/$WIN" \ --exec "$LAUNCHER_NAME.cmd" \ --output "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" \ &> /dev/null -- 2.45.2 From 3073a732f67ef10424de47c7a3ac9e6f94162029 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 17 May 2024 22:56:20 +0200 Subject: [PATCH 2/2] Updating warp-packer call, adding prefix and Spring-Boot support --- warp4j | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/warp4j b/warp4j index 19f788a..c6989c7 100755 --- a/warp4j +++ b/warp4j @@ -15,6 +15,9 @@ function print_help { 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 ' --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 ' echo ' override output directory;' echo ' this is relative to current PWD' @@ -136,6 +139,10 @@ while [[ $# -gt 0 ]]; do AUTO_CLASS_PATH=true shift ;; + --spring-boot) + SPRING_BOOT_APPLICATION=true + shift + ;; -j|--java-version) JAVA_VERSION="$2" JAVA_VERSION_OVERRIDEN=true @@ -679,6 +686,12 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then 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}/* --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 echo "Fetch modules with default behavior" MODULES=$("$JDEPS" --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE "$JAR" | grep -v Warning) -- 2.45.2