From 08e3c17c3eb990617313a2258318f6578872bba8 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 09:43:52 +0200 Subject: [PATCH 01/10] Debugging build step --- .drone.yml | 1 + warp4j | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 27bce4f..ff3dfb7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -118,6 +118,7 @@ steps: trigger: branch: - *branch + - feature/* event: - custom diff --git a/warp4j b/warp4j index b2a55e6..399aa87 100755 --- a/warp4j +++ b/warp4j @@ -737,12 +737,13 @@ function warp_targets() { if [[ ${TARGETS[*]} == *"$LIN"* ]]; then echo "Warping for $LIN..." mkdir -p "$WARPED_TEMP_PATH/$LIN" + echo "warp-packer --arch linux-x64 --input_dir '$BUNDLES_PATH/$LIN' --exec '$LAUNCHER_NAME.sh' --output '$WARPED_TEMP_PATH/$LIN/$APP_NAME'" warp-packer \ --arch linux-x64 \ --input_dir "$BUNDLES_PATH/$LIN" \ --exec "$LAUNCHER_NAME.sh" \ --output "$WARPED_TEMP_PATH/$LIN/$APP_NAME" \ - >&2 + &> /dev/null fail_if $? "Failed to warp for $LIN" echo "Archiving for $LIN..." tar -C "$WARPED_TEMP_PATH/$LIN" -czf "$WARPED_TEMP_PATH/$APP_NAME-$LIN-x64.tar.gz" "$APP_NAME" @@ -760,7 +761,7 @@ function warp_targets() { --input_dir "$BUNDLES_PATH/$MAC" \ --exec "$LAUNCHER_NAME.sh" \ --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ - >&2 + &> /dev/null fail_if $? "Failed to warp for $MAC" echo "Archiving for $MAC..." tar -C "$WARPED_TEMP_PATH/$MAC" -czf "$WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz" "$APP_NAME" @@ -778,7 +779,7 @@ function warp_targets() { --input_dir "$BUNDLES_PATH/$WIN" \ --exec "$LAUNCHER_NAME.cmd" \ --output "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" \ - >&2 + &> /dev/null fail_if $? "Failed to warp for $WIN" if command -v zip &> /dev/null ; then ( echo "Archiving for $WIN..." -- 2.45.2 From d8af2f540260260c03b5ba4773556fe0dd7be7a1 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 19:29:48 +0200 Subject: [PATCH 02/10] Debugging build step --- warp4j | 1 + 1 file changed, 1 insertion(+) diff --git a/warp4j b/warp4j index 399aa87..dbe4559 100755 --- a/warp4j +++ b/warp4j @@ -683,6 +683,7 @@ function create_optimized_runtime() { local machine=$2 local jmods=$JAVA_DOWNLOAD_PATH/$platform/$machine/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR/jmods echo "Creating minimal runtime for $platform..." + echo "$JLINK --no-header-files --no-man-pages --strip-debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$machine/$BUNDLED_DISTRO_SUBDIR'" "$JLINK" \ --no-header-files \ --no-man-pages \ -- 2.45.2 From f27ede1ee908a55cbae968f64e664f6daa532d36 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 20:00:43 +0200 Subject: [PATCH 03/10] Fixing missing parameter --- warp4j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/warp4j b/warp4j index dbe4559..b9bd5a0 100755 --- a/warp4j +++ b/warp4j @@ -707,7 +707,7 @@ function create_bundle() { case $JAVA_DISTRO_TYPE in $DISTRO_TYPE_JDK) - create_optimized_runtime $platform + create_optimized_runtime $platform $machine ;; $DISTRO_TYPE_JRE) mkdir -p "$BUNDLES_PATH/$platform/$machine/$BUNDLED_DISTRO_SUBDIR" @@ -728,7 +728,7 @@ function create_bundle() { rm -rf "$BUNDLES_PATH" # actually create bundles for all targets for target in ${TARGETS[@]}; do - create_bundle $target + create_bundle $target $X64 done # creates binaries and archives for all targets -- 2.45.2 From f0e904b9fb3fae2fca479e187fe40e043bd47657 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 21:31:13 +0200 Subject: [PATCH 04/10] Debug drone messages --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index ff3dfb7..30d2f1f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -102,6 +102,7 @@ steps: <<: *default_build_option settings: dockerfile: Dockerfile + debug: true - name: *notification_name <<: *default_notification_option -- 2.45.2 From 8f442e0e50a040e0a763fc5c071d04d074a0027d Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 21:59:32 +0200 Subject: [PATCH 05/10] Using temporary older version of plugins/docker --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 30d2f1f..dfca335 100644 --- a/.drone.yml +++ b/.drone.yml @@ -72,7 +72,7 @@ notification_name: ¬ification_name Send Notification # Basic build options x-step: &default_build_option - image: plugins/docker + image: plugins/docker:20.17.4 settings: dry_run: *dry_run mirror: https://registry.phoenix.ipv64.de @@ -102,7 +102,6 @@ steps: <<: *default_build_option settings: dockerfile: Dockerfile - debug: true - name: *notification_name <<: *default_notification_option -- 2.45.2 From 51337c59d061aa1643972ec6889000753335240a Mon Sep 17 00:00:00 2001 From: david Date: Wed, 15 May 2024 06:46:06 +0200 Subject: [PATCH 06/10] Removing binutils and using correct strip depending on java version --- Dockerfile | 1 - warp4j | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3206eca..6fb222a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM debian:stable-slim RUN apt-get update && apt-get install -y \ - binutils \ curl \ file \ unzip \ diff --git a/warp4j b/warp4j index b9bd5a0..9e99ed6 100755 --- a/warp4j +++ b/warp4j @@ -682,15 +682,19 @@ function create_optimized_runtime() { local platform=$1 local machine=$2 local jmods=$JAVA_DOWNLOAD_PATH/$platform/$machine/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR/jmods + local strip-debug=strip-debug echo "Creating minimal runtime for $platform..." - echo "$JLINK --no-header-files --no-man-pages --strip-debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$machine/$BUNDLED_DISTRO_SUBDIR'" + if [[ $JAVA_VERSION_BASE >= 13 ]]; then + $strip-debug=strip-java-debug-attributes + fi + echo "$JLINK --no-header-files --no-man-pages --$strip-debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR'" "$JLINK" \ --no-header-files \ --no-man-pages \ - --strip-debug \ + --$strip-debug \ --module-path "$jmods" \ --add-modules $MODULES \ - --output "$BUNDLES_PATH/$platform/$machine/$BUNDLED_DISTRO_SUBDIR" + --output "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR" fail_if $? "Failed to optimize runtime" } -- 2.45.2 From b140323b6175e67a5cd63857ecdde867875ec524 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 15 May 2024 07:00:56 +0200 Subject: [PATCH 07/10] Using correct comparator --- warp4j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warp4j b/warp4j index 9e99ed6..dc940da 100755 --- a/warp4j +++ b/warp4j @@ -684,7 +684,7 @@ function create_optimized_runtime() { local jmods=$JAVA_DOWNLOAD_PATH/$platform/$machine/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR/jmods local strip-debug=strip-debug echo "Creating minimal runtime for $platform..." - if [[ $JAVA_VERSION_BASE >= 13 ]]; then + if [[ $JAVA_VERSION_BASE -ge 13 ]]; then $strip-debug=strip-java-debug-attributes fi echo "$JLINK --no-header-files --no-man-pages --$strip-debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR'" -- 2.45.2 From bfe5a0c3b59a7858a0b2b3fce43605ff19ee7369 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 15 May 2024 07:21:25 +0200 Subject: [PATCH 08/10] Fixing variable --- warp4j | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/warp4j b/warp4j index dc940da..bdd9701 100755 --- a/warp4j +++ b/warp4j @@ -682,16 +682,16 @@ function create_optimized_runtime() { local platform=$1 local machine=$2 local jmods=$JAVA_DOWNLOAD_PATH/$platform/$machine/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR/jmods - local strip-debug=strip-debug + local strip_debug=strip-debug echo "Creating minimal runtime for $platform..." if [[ $JAVA_VERSION_BASE -ge 13 ]]; then - $strip-debug=strip-java-debug-attributes + $strip_debug=strip-java-debug-attributes fi - echo "$JLINK --no-header-files --no-man-pages --$strip-debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR'" + echo "$JLINK --no-header-files --no-man-pages --$strip_debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR'" "$JLINK" \ --no-header-files \ --no-man-pages \ - --$strip-debug \ + --$strip_debug \ --module-path "$jmods" \ --add-modules $MODULES \ --output "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR" -- 2.45.2 From 9712e0ebaf0e04412f0d6237de8ef3880b4a2d88 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 15 May 2024 07:45:21 +0200 Subject: [PATCH 09/10] Fixing variable --- warp4j | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/warp4j b/warp4j index bdd9701..0ea1ff5 100755 --- a/warp4j +++ b/warp4j @@ -61,7 +61,7 @@ function fail_with() { fail } -# if error code is not zero fail with a message +# if error code is not zero fail with a message function fail_if() { local error_code=$1 local message=$2 @@ -189,7 +189,7 @@ THIS_MACHINE=$(get_this_machine) # checks if all dependencies are available function check_deps() { - local deps=( + local deps=( "awk" \ "curl" \ "file" \ @@ -348,7 +348,7 @@ if [[ $LIST_RELEASES ]]; then fi JAR_FILE_BASE_NAME=$(basename -- "$JAR") # "my-app.jar" -JAR_EXTENSION="${JAR_FILE_BASE_NAME##*.}" # "jar" +JAR_EXTENSION="${JAR_FILE_BASE_NAME##*.}" # "jar" JAR_EXTENSION_LOWERCASE=$(printf "%s" "$JAR_EXTENSION" | tr '[:upper:]' '[:lower:]') # "jar" JAR_NAME="${JAR_FILE_BASE_NAME%.*}" # "my-app" @@ -368,7 +368,7 @@ if ([[ $(file $JAR) != *"Java"* ]] && # it could be "Java archive data" or "Java fi # even if this platform is not targeted, we still need -# a JDK for this platform to optimize JDKs for other platforms +# a JDK for this platform to optimize JDKs for other platforms TARGETS_TO_CACHE=${TARGETS[@]} if [[ $THIS_MACHINE == $X64 ]] && # if architecture is x86 [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]] && # and if using JDK (not JRE) @@ -421,7 +421,7 @@ JAVA=$DIR/$JAVA_DIST/bin/'"$JAVA_EXEC"' JAR_PATH=$DIR/$JAR exec "$JAVA" '"$JVM_OPTIONS"' -jar "$JAR_PATH" "$@" -' +' } # prints a launcher for windows cmd @@ -439,7 +439,7 @@ SET "JAR_PATH=%~dp0\%JAR%" START %JAVA% '"$JVM_OPTIONS"' -jar %JAR_PATH% %* EXIT /B %ERRORLEVEL% -' +' } # these files are success markers @@ -536,7 +536,7 @@ function download_distro() { ) } -# ensures required distro is in cache +# ensures required distro is in cache function ensure_distro_cached() { local platform=$1 local architecture=$2 @@ -551,7 +551,7 @@ function ensure_distro_cached() { download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link" else CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $LATEST_LTS) - fi + fi else if [[ ! $(find_latest_cached $platform $architecture $JAVA_VERSION) ]]; then distro_info=$(fetch_distro_info $platform $architecture $JAVA_VERSION_BASE) @@ -560,7 +560,7 @@ function ensure_distro_cached() { download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link" else CONCRETE_JAVA_VERSION=$(find_latest_cached $architecture $platform $JAVA_VERSION) - fi + fi fi else if [[ -z $JAVA_VERSION ]]; then @@ -588,7 +588,7 @@ fi UNPACKED_SUBDIR="distro" -# ensures required distro uncompressed +# ensures required distro uncompressed function ensure_distro_unpacked() { local platform=$1 local architecture=$2 @@ -642,7 +642,7 @@ function ensure_distro_unpacked() { fi } -# actually ensure required distro uncompressed +# actually ensure required distro uncompressed for target in ${TARGETS[@]}; do ensure_distro_unpacked $target $X64 $CONCRETE_JAVA_VERSION done @@ -685,7 +685,7 @@ function create_optimized_runtime() { local strip_debug=strip-debug echo "Creating minimal runtime for $platform..." if [[ $JAVA_VERSION_BASE -ge 13 ]]; then - $strip_debug=strip-java-debug-attributes + strip_debug=strip-java-debug-attributes fi echo "$JLINK --no-header-files --no-man-pages --$strip_debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR'" "$JLINK" \ @@ -798,9 +798,9 @@ function warp_targets() { mv "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" "$WARPED_PATH/$APP_NAME-windows-x64.exe" rmdir "$WARPED_TEMP_PATH/$WIN" fi - + rmdir "$WARPED_TEMP_PATH" } # actually create binaries and archives for all targets -warp_targets \ No newline at end of file +warp_targets -- 2.45.2 From 1b57d731862bbec247eeafefcbda5a208d9f06e2 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 15 May 2024 11:09:36 +0200 Subject: [PATCH 10/10] Reverting changes for debugging --- .drone.yml | 3 +-- warp4j | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index dfca335..27bce4f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -72,7 +72,7 @@ notification_name: ¬ification_name Send Notification # Basic build options x-step: &default_build_option - image: plugins/docker:20.17.4 + image: plugins/docker settings: dry_run: *dry_run mirror: https://registry.phoenix.ipv64.de @@ -118,7 +118,6 @@ steps: trigger: branch: - *branch - - feature/* event: - custom diff --git a/warp4j b/warp4j index 0ea1ff5..ce09222 100755 --- a/warp4j +++ b/warp4j @@ -687,7 +687,6 @@ function create_optimized_runtime() { if [[ $JAVA_VERSION_BASE -ge 13 ]]; then strip_debug=strip-java-debug-attributes fi - echo "$JLINK --no-header-files --no-man-pages --$strip_debug --module-path '$jmods' --add-modules $MODULES --output '$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR'" "$JLINK" \ --no-header-files \ --no-man-pages \ @@ -742,7 +741,6 @@ function warp_targets() { if [[ ${TARGETS[*]} == *"$LIN"* ]]; then echo "Warping for $LIN..." mkdir -p "$WARPED_TEMP_PATH/$LIN" - echo "warp-packer --arch linux-x64 --input_dir '$BUNDLES_PATH/$LIN' --exec '$LAUNCHER_NAME.sh' --output '$WARPED_TEMP_PATH/$LIN/$APP_NAME'" warp-packer \ --arch linux-x64 \ --input_dir "$BUNDLES_PATH/$LIN" \ -- 2.45.2