From 938ac7f33d5a2fe62003b029f41f3eb2804605a6 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 May 2024 09:09:28 +0200 Subject: [PATCH 01/45] Feature: Updating to new domain name --- Dockerfile | 2 +- INSTALL.md | 4 ++-- README.md | 4 ++-- install | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c6eb34..67ee817 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y \ zip \ && rm -rf /var/lib/apt/lists/* RUN curl -fsSL -o /tmp/warp-packer \ - https://git.kirby-link.dd-dns.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 \ + https://git.phoenix.ipv64.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 \ && install -D \ --mode=755 \ --owner=root \ diff --git a/INSTALL.md b/INSTALL.md index a15c2af..b1cf4db 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -4,11 +4,11 @@ Here are several more ways to install `warp4j`. ## Manual -First install [warp-packer](https://git.kirby-link.dd-dns.de/public/warp/releases) and ensure other common tools available: `awk`, `curl`, `file`, `grep`, `sed`, `sort`, `tar`, `unzip`, optional: `zip`. Then install `warp4j` like this: +First install [warp-packer](https://git.phoenix.ipv64.de/public/warp/releases) and ensure other common tools available: `awk`, `curl`, `file`, `grep`, `sed`, `sort`, `tar`, `unzip`, optional: `zip`. Then install `warp4j` like this: ``` $ LOCATION=/usr/local/bin \ -LINK=https://git.kirby-link.dd-dns.de/public/warp4j/raw/branch/master/warp4j \ +LINK=https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j \ TEMP_LOCATION=/tmp/warp4j \ bash -c 'curl -fsSL -o $TEMP_LOCATION $LINK && \ sudo install -D \ diff --git a/README.md b/README.md index 3bdbd20..6441bd5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Turn JAR (java archive) into self-contained executable in a single command. - downloads java runtimes automatically - makes runtimes optimized for your application -- creates self-contained binaries for Linux, macOS and Windows using [warp-packer](https://git.kirby-link.dd-dns.de/public/warp) +- creates self-contained binaries for Linux, macOS and Windows using [warp-packer](https://git.phoenix.ipv64.de/public/warp) - works on Linux, macOS and Windows (with Windows Subsystem for Linux) - supports cross "compilation" - does not require neither JDK nor JRE installed @@ -20,7 +20,7 @@ Just put both `warp4j` and `warp-packer` somewhere in your PATH and run `warp4j Curl one-liner installs latest versions of both `warp4j` and `warp-packer`: ``` -$ bash -c "$(curl -fsSL https://git.kirby-link.dd-dns.de/public/warp4j/raw/branch/master/install)" +$ bash -c "$(curl -fsSL https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install)" ``` This script will show missing dependencies (if there are any), they must be installed with your package manager. diff --git a/install b/install index a107c08..355a0a5 100755 --- a/install +++ b/install @@ -12,9 +12,9 @@ function fail() { # platform IDs LIN=linux -LIN_URL=https://git.kirby-link.dd-dns.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 +LIN_URL=https://git.phoenix.ipv64.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 MAC=macos -MAC_URL=https://git.kirby-link.dd-dns.de/attachments/b09c6469-406a-4dd1-b5e8-1294a3aabf0f +MAC_URL=https://git.phoenix.ipv64.de/attachments/b09c6469-406a-4dd1-b5e8-1294a3aabf0f WIN=windows # returns this platform ID @@ -87,7 +87,7 @@ function get_missing_deps() { done } -WARP4J_LINK="https://git.kirby-link.dd-dns.de/public/warp4j/raw/branch/master/warp4j" +WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j" echo "Getting information about warp-packer releases..." WARP_LINK=$(get_warp_link $THIS_PLATFORM) -- 2.45.2 From d15b4513193140675a516251cffeb6e07716d304 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 May 2024 20:16:48 +0200 Subject: [PATCH 02/45] Feature: Updating url and parser to fetch from Adoptium --- warp4j | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/warp4j b/warp4j index f853a10..cbfe4f8 100755 --- a/warp4j +++ b/warp4j @@ -273,20 +273,20 @@ function choose_distro_type() { # actually choose distro type JAVA_DISTRO_TYPE=$(choose_distro_type) -# generates adoptopenjdk api url +# generates adoptium api url function api_url() { local request=$1 # info/binary local platform=$2 # windows/linux/macos - # adoptopenjdk uses "mac" instead of "macos" + # adoptium uses "mac" instead of "macos" if [[ $platform == "macos" ]]; then platform="mac" fi - echo -n "https://api.adoptopenjdk.net/v2/\ -$request/releases/openjdk$JAVA_VERSION_BASE?\ -openjdk_impl=$JVM_IMPL&\ -os=$platform&\ -arch=x64&\ -type=$JAVA_DISTRO_TYPE" + + echo -n "https://api.adoptium.net/v3/assets/feature_releases/\ +$JAVA_VERSION_BASE/ga?architecture=x64&heap_size=normal&image_type=jdk&\ +os=$platform&page=0&page_size=20&project=$JAVA_DISTRO_TYPE&\ +sort_method=DEFAULT&sort_order=DESC&vendor=eclipse" + } # requests info about all releases for given platform and java branch @@ -469,7 +469,7 @@ function find_latest_cached() { # finds latest concrete distro version that matches version specified by user function find_latest_version() { - local info=$1 # info fetched from AdoptOpenJDK + local info=$1 # info fetched from Adoptium local user_version=$2 # version supplied by user is a template local matched_version # latest version that matches the template local versions # all versions @@ -495,12 +495,11 @@ function find_latest_version() { # finds direct link to download concrete runtime version function find_distro_link() { - local info=$1 # info fetched from AdoptOpenJDK + local info=$1 # info fetched from Adoptium local version=$2 # concrete distro version like "11.0.2+9" local link=$(echo "$info" \ - | grep -B13 "\"heap_size\": \"normal\"" \ - | grep -B11 "\"semver\": \"$version\"" \ - | grep "binary_link" \ + | grep -B14 "\"release_name\": \"jdk-$version\"" \ + | grep "\"link\":" \ | sort --reverse \ | head -n 1 \ | awk '{print $2}' \ -- 2.45.2 From 33521690288f15528b25f8ac66c381812631d1f8 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 May 2024 21:07:27 +0200 Subject: [PATCH 03/45] Feature: Fixing class-path --- warp4j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warp4j b/warp4j index cbfe4f8..db73d31 100755 --- a/warp4j +++ b/warp4j @@ -652,7 +652,7 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then 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) + 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) 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 From 21cf3c330bb476bf4642f019874b5a386e4bc64a Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 May 2024 23:55:00 +0200 Subject: [PATCH 04/45] Feature: Adding first draft of .drone.yml. --- .drone.yml | 125 +++++++++++++++++++++++++++++++++++++++++++ dockerhub/Dockerfile | 27 ---------- dockerhub/README.md | 18 ------- 3 files changed, 125 insertions(+), 45 deletions(-) create mode 100644 .drone.yml delete mode 100644 dockerhub/Dockerfile delete mode 100644 dockerhub/README.md diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..708add0 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,125 @@ +# Variables +tag: &tag latest +repo: &repo phoenix.ipv64.de/kirbylink/warp4 +branch: &branch master +dry_run: &dry_run false +step_name: &step_name warp4 +pipeline_name: &pipeline_name warp4 build and push +notification_name: ¬ification_name Send Notification + +# Basic build options +x-step: &default_build_option + image: plugins/docker + settings: + dry_run: *dry_run + mirror: https://registry.phoenix.ipv64.de + repo: *repo + tags: + - *tag + +x-step: &default_notification_option + image: phoenix.ipv64.de/kirbylink/drone-gotify:latest + settings: + gotifytoken: + from_secret: plugin_gotifytoken + gotifyendpoint: + from_secret: plugin_gotifyendpoint + gotifytitle: *step_name + gotifypriority: 5 + +kind: pipeline +type: docker +platform: + os: linux + arch: arm64 +name: *pipeline_name + +steps: +- name: *step_name + <<: *default_build_option + settings: + dockerfile: Dockerfile + +- name: *notification_name + <<: *default_notification_option + settings: + message: > + {{#success build.status}} + Build of docker image on build {{build.number}} succeeded on {{repo.name}}. Build link: {{build.link}} + {{else}} + WARNING. Build of docker image on build {{build.number}} failed on {{repo.name}}. Build link: {{build.link}} + {{/success}} + when: + status: [ success, failure ] + +trigger: + branch: + - *branch + event: + - push + - custom + +--- + +# Variables +tag: &tag testing +repo: &repo phoenix.ipv64.de/kirbylink/warp4 +branch: &exclude_branch master +dry_run: &dry_run true +step_name: &step_name warp4 +pipeline_name: &pipeline_name warp4 build only (testing) +notification_name: ¬ification_name Send Notification + +# Basic build options +x-step: &default_build_option + image: plugins/docker + settings: + dry_run: *dry_run + mirror: https://registry.phoenix.ipv64.de + repo: *repo + tags: + - *tag + +x-step: &default_notification_option + image: phoenix.ipv64.de/kirbylink/drone-gotify:latest + settings: + gotifytoken: + from_secret: plugin_gotifytoken + gotifyendpoint: + from_secret: plugin_gotifyendpoint + gotifytitle: *step_name + gotifypriority: 5 + +kind: pipeline +type: docker +platform: + os: linux + arch: arm64 +name: *pipeline_name + +steps: +- name: *step_name + <<: *default_build_option + settings: + dockerfile: Dockerfile + +- name: *notification_name + <<: *default_notification_option + settings: + message: > + {{#success build.status}} + Test build of docker image on build {{build.number}} succeeded on {{repo.name}}. Build link: {{build.link}} + {{else}} + WARNING. Test build of docker image on build {{build.number}} failed on {{repo.name}}. Build link: {{build.link}} + {{/success}} + when: + status: [ success, failure ] + +trigger: + branch: + exclude: + - *exclude_branch + event: + - push + - custom + \ No newline at end of file diff --git a/dockerhub/Dockerfile b/dockerhub/Dockerfile deleted file mode 100644 index 11a726e..0000000 --- a/dockerhub/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM debian:stable-slim -RUN apt-get update && apt-get install -y \ - curl \ - file \ - unzip \ - zip \ - && rm -rf /var/lib/apt/lists/* -RUN curl -fsSL -o /tmp/warp-packer \ - https://github.com/dgiagio/warp/releases/download/v0.3.0/linux-x64.warp-packer \ - && install -D \ - --mode=755 \ - --owner=root \ - --group=root \ - /tmp/warp-packer \ - /usr/local/bin \ - && rm /tmp/warp-packer -RUN curl -fsSL -o /tmp/warp4j \ - https://raw.githubusercontent.com/guziks/warp4j/stable/warp4j \ - && install -D \ - --mode=755 \ - --owner=root \ - --group=root \ - /tmp/warp4j \ - /usr/local/bin \ - && rm /tmp/warp4j -WORKDIR /workdir -ENTRYPOINT [ "/usr/local/bin/warp4j" ] diff --git a/dockerhub/README.md b/dockerhub/README.md deleted file mode 100644 index 3d7b19c..0000000 --- a/dockerhub/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Warp4j - -Turn JAR (java archive) into self-contained executable in a single command. - -See project [page](https://github.com/guziks/warp4j) for more information. - -## Usage - -``` -$ docker run --rm -it \ - -e "WARP4J_CACHE=/cache" \ - --volume :/cache \ - --volume :/workdir \ - --user $(id -u):$(id -g) \ - guziks/warp4j:stable -``` - -Change according to your requirements, but volume with working directory is mandatory. -- 2.45.2 From 5d03fbe45ed0d7921d36deeec0cd219139997ffe Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 May 2024 00:15:44 +0200 Subject: [PATCH 05/45] Feature: Changing from push to pull_request event --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 708add0..ab81053 100644 --- a/.drone.yml +++ b/.drone.yml @@ -56,7 +56,7 @@ trigger: branch: - *branch event: - - push + - pull_request - custom --- @@ -120,6 +120,6 @@ trigger: exclude: - *exclude_branch event: - - push + - pull_request - custom \ No newline at end of file -- 2.45.2 From f463391e0f9d2f3640093d6dd8df71c80b236f6f Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 May 2024 08:11:28 +0200 Subject: [PATCH 06/45] Feature: Fixing name in .drone.yml --- .drone.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index ab81053..f74fbbb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,10 +1,10 @@ # Variables tag: &tag latest -repo: &repo phoenix.ipv64.de/kirbylink/warp4 +repo: &repo phoenix.ipv64.de/kirbylink/warp4j branch: &branch master dry_run: &dry_run false -step_name: &step_name warp4 -pipeline_name: &pipeline_name warp4 build and push +step_name: &step_name warp4j +pipeline_name: &pipeline_name warp4j build and push notification_name: ¬ification_name Send Notification # Basic build options @@ -63,11 +63,11 @@ trigger: # Variables tag: &tag testing -repo: &repo phoenix.ipv64.de/kirbylink/warp4 +repo: &repo phoenix.ipv64.de/kirbylink/warp4j branch: &exclude_branch master dry_run: &dry_run true -step_name: &step_name warp4 -pipeline_name: &pipeline_name warp4 build only (testing) +step_name: &step_name warp4j +pipeline_name: &pipeline_name warp4j build only (testing) notification_name: ¬ification_name Send Notification # Basic build options -- 2.45.2 From 1b395c6c682a530a352675c3011c7714515931d7 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 May 2024 08:48:01 +0200 Subject: [PATCH 07/45] Feature: Remove jvm-impl choice since Adoptium only offers hotspot impl --- warp4j | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/warp4j b/warp4j index db73d31..2e257ef 100755 --- a/warp4j +++ b/warp4j @@ -37,8 +37,6 @@ function print_help { echo ' --windows create binary for Windows' echo ' if no targets are specified then binaries for' echo ' all targets are created' - echo ' --jvm-impl jvm implementation: hotspot or openj9' - echo ' (default: hotspot)' echo ' --jvm-options ' echo ' passed to java like this:' echo ' "java -jar ";' @@ -147,10 +145,6 @@ while [[ $# -gt 0 ]]; do TARGETS+=($WIN) shift ;; - --jvm-impl) - JVM_IMPL="$2" - shift 2 - ;; --jvm-options) JVM_OPTIONS="$2" shift 2 @@ -231,22 +225,13 @@ if [[ $JAVA_VERSION ]] && ! java_version_is_correct $JAVA_VERSION ; then fail_with "JDK version \"$JAVA_VERSION\" is not correct" fi -JVM_IMPL_HOTSPOT=hotspot -JVM_IMPL_OPENJ9=openj9 - -# validate jvm implementation -if [[ $JVM_IMPL ]] && - [[ $JVM_IMPL != $JVM_IMPL_HOTSPOT ]] && - [[ $JVM_IMPL != $JVM_IMPL_OPENJ9 ]]; then - fail_with "jvm implementation \"$JVM_IMPL\" is not correct" -fi +JVM_IMPL=hotspot LATEST_LTS=17 # latest LTS java branch # default options test -z $JAVA_VERSION && JAVA_VERSION=$LATEST_LTS test -z $TARGETS && TARGETS=($LIN $MAC $WIN) -test -z $JVM_IMPL && JVM_IMPL=$JVM_IMPL_HOTSPOT # returns java branch version function get_base_version() { -- 2.45.2 From 7a930d7def9eb7c99899a101a486b8b425c7ae2e Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 May 2024 09:13:20 +0200 Subject: [PATCH 08/45] Feature: Adding test build for testing images --- .drone.yml | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index f74fbbb..9f88142 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,6 +61,68 @@ trigger: --- +# Variables +tag: &tag testing +repo: &repo phoenix.ipv64.de/kirbylink/warp4j +branch: &branch develop +dry_run: &dry_run false +step_name: &step_name warp4j +pipeline_name: &pipeline_name warp4j build only and push (testing) +notification_name: ¬ification_name Send Notification + +# Basic build options +x-step: &default_build_option + image: plugins/docker + settings: + dry_run: *dry_run + mirror: https://registry.phoenix.ipv64.de + repo: *repo + tags: + - *tag + +x-step: &default_notification_option + image: phoenix.ipv64.de/kirbylink/drone-gotify:latest + settings: + gotifytoken: + from_secret: plugin_gotifytoken + gotifyendpoint: + from_secret: plugin_gotifyendpoint + gotifytitle: *step_name + gotifypriority: 5 + +kind: pipeline +type: docker +platform: + os: linux + arch: arm64 +name: *pipeline_name + +steps: +- name: *step_name + <<: *default_build_option + settings: + dockerfile: Dockerfile + +- name: *notification_name + <<: *default_notification_option + settings: + message: > + {{#success build.status}} + Build of test docker image on build {{build.number}} succeeded on {{repo.name}}. Build link: {{build.link}} + {{else}} + WARNING. Build of docker image on build {{build.number}} failed on {{repo.name}}. Build link: {{build.link}} + {{/success}} + when: + status: [ success, failure ] + +trigger: + branch: + - *branch + event: + - custom + +--- + # Variables tag: &tag testing repo: &repo phoenix.ipv64.de/kirbylink/warp4j @@ -121,5 +183,3 @@ trigger: - *exclude_branch event: - pull_request - - custom - \ No newline at end of file -- 2.45.2 From 897fc83880b49ca3827ee543a84fa8c4c52233b9 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 May 2024 09:19:32 +0200 Subject: [PATCH 09/45] Fixing typo in .drone.yml --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 9f88142..27bce4f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -67,7 +67,7 @@ repo: &repo phoenix.ipv64.de/kirbylink/warp4j branch: &branch develop dry_run: &dry_run false step_name: &step_name warp4j -pipeline_name: &pipeline_name warp4j build only and push (testing) +pipeline_name: &pipeline_name warp4j build and push (testing) notification_name: ¬ification_name Send Notification # Basic build options -- 2.45.2 From 83e17c9c42afd7ff5c81da0a0d0c69a876c68aa8 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 13 May 2024 08:05:17 +0200 Subject: [PATCH 10/45] Adding support to build x64 application on linux aarch64 architecture --- warp4j | 103 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 34 deletions(-) diff --git a/warp4j b/warp4j index 2e257ef..2ba383f 100755 --- a/warp4j +++ b/warp4j @@ -93,6 +93,22 @@ function get_this_platform() { esac } +# platform Machine +X64=x64 +AARCH64=aarch64 + +# returns this platform machine +function get_this_machine() { + local this_machine="$(uname -m)" + case $this_machine in + x86_64) echo $X64 ;; + aarch64) echo $AARCH64 ;; + *) + fail_with "Unsupported machine $this_machine" + ;; + esac +} + # show help if no arguments specified if [[ $# -eq 0 ]]; then print_help @@ -169,6 +185,7 @@ done set -- "${POSITIONAL[@]}" # restore positional arguments THIS_PLATFORM=$(get_this_platform) +THIS_MACHINE=$(get_this_machine) # checks if all dependencies are available function check_deps() { @@ -260,15 +277,15 @@ JAVA_DISTRO_TYPE=$(choose_distro_type) # generates adoptium api url function api_url() { - local request=$1 # info/binary - local platform=$2 # windows/linux/macos + local platform=$1 # windows/linux/macos + local architecture=$2 # adoptium uses "mac" instead of "macos" if [[ $platform == "macos" ]]; then platform="mac" fi echo -n "https://api.adoptium.net/v3/assets/feature_releases/\ -$JAVA_VERSION_BASE/ga?architecture=x64&heap_size=normal&image_type=jdk&\ +$JAVA_VERSION_BASE/ga?architecture=$architecture&heap_size=normal&image_type=jdk&\ os=$platform&page=0&page_size=20&project=$JAVA_DISTRO_TYPE&\ sort_method=DEFAULT&sort_order=DESC&vendor=eclipse" @@ -277,8 +294,9 @@ sort_method=DEFAULT&sort_order=DESC&vendor=eclipse" # requests info about all releases for given platform and java branch function fetch_distro_info() { local platform=$1 # platform ID - local branch=$2 # 8/9/10/11... - curl -s $(api_url info $platform) + local architecture=$2 + local branch=$3 # 8/9/10/11... + curl -s $(api_url $platform $architecture) fail_if $? "Failed to fetch java $branch info" } @@ -308,7 +326,7 @@ function list_releases() { local matched local printed local platform="linux" # just picked any - info=$(fetch_distro_info $platform $JAVA_VERSION_BASE) + info=$(fetch_distro_info $platform $X64 $JAVA_VERSION_BASE) matched=$(find_matched_versions "$info" $JAVA_VERSION) if [[ $matched ]]; then echo "Releases that match $JAVA_VERSION:" @@ -329,8 +347,8 @@ if [[ $LIST_RELEASES ]]; then exit fi -JAR_FILE_BASE_NAME=$(basename -- "$JAR") # "my-app.jAr" -JAR_EXTENSION="${JAR_FILE_BASE_NAME##*.}" # "jAr" +JAR_FILE_BASE_NAME=$(basename -- "$JAR") # "my-app.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" @@ -352,7 +370,8 @@ fi # even if this platform is not targeted, we still need # a JDK for this platform to optimize JDKs for other platforms TARGETS_TO_CACHE=${TARGETS[@]} -if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]] && # if usind JDK (not JRE) +if [[ $THIS_MACHINE == $X64 ]] && # if architecture is x86 + [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]] && # and if using JDK (not JRE) [[ ${TARGETS[@]} != *"$THIS_PLATFORM"* ]]; then # and this platform is not targeted TARGETS_TO_CACHE+=($THIS_PLATFORM) fi @@ -430,8 +449,9 @@ MARKER_UNPACKED="unpacked" # after runtime uncompress # returns latest cached version that matches version specified by user function find_latest_cached() { local platform=$1 - local user_version=$2 - local platform_dir=$JAVA_DOWNLOAD_PATH/$platform/ + local architecture=$2 + local user_version=$3 + local platform_dir=$JAVA_DOWNLOAD_PATH/$platform/$architecture # turning something like "11.0.1+13" into regexp like "^11\.0\.1\+13" local pattern="^"$(echo $user_version \ | sed -e 's/\./\\\./g' -e 's/\+/\\\+/g') @@ -498,9 +518,11 @@ function find_distro_link() { # downloads runtime distro function download_distro() { local platform=$1 - local version=$2 - local link=$3 - local download_dir=$JAVA_DOWNLOAD_PATH/$platform/$version + local architecture=$2 + local version=$3 + local link=$4 + local download_dir=$JAVA_DOWNLOAD_PATH/$platform/$architecture/$version + echo "Download link: $link" echo "Downloading $JVM_IMPL-$JAVA_DISTRO_TYPE-$version-$platform..." rm -rf "$download_dir" mkdir -p "$download_dir" @@ -517,55 +539,61 @@ function download_distro() { # ensures required distro is in cache function ensure_distro_cached() { local platform=$1 + local architecture=$2 local distro_info local distro_link if [[ -z $PULL ]]; then if [[ -z $JAVA_VERSION_OVERRIDEN ]]; then - if [[ ! $(find_latest_cached $platform $LATEST_LTS) ]]; then - distro_info=$(fetch_distro_info $platform $LATEST_LTS) + if [[ ! $(find_latest_cached $platform $architecture $LATEST_LTS) ]]; then + distro_info=$(fetch_distro_info $platform $architecture $LATEST_LTS) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $LATEST_LTS) distro_link=$(find_distro_link "$distro_info" $CONCRETE_JAVA_VERSION) - download_distro $platform $CONCRETE_JAVA_VERSION "$distro_link" + download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link" else - CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $LATEST_LTS) + CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $LATEST_LTS) fi else - if [[ ! $(find_latest_cached $platform $JAVA_VERSION) ]]; then - distro_info=$(fetch_distro_info $platform $JAVA_VERSION_BASE) + if [[ ! $(find_latest_cached $platform $architecture $JAVA_VERSION) ]]; then + distro_info=$(fetch_distro_info $platform $architecture $JAVA_VERSION_BASE) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $JAVA_VERSION) distro_link=$(find_distro_link "$distro_info" $CONCRETE_JAVA_VERSION) - download_distro $platform $CONCRETE_JAVA_VERSION "$distro_link" + download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link" else - CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $JAVA_VERSION) + CONCRETE_JAVA_VERSION=$(find_latest_cached $architecture $platform $JAVA_VERSION) fi fi else if [[ -z $JAVA_VERSION ]]; then - distro_info=$(fetch_distro_info $platform $LATEST_LTS) + distro_info=$(fetch_distro_info $platform $architecture $LATEST_LTS) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $LATEST_LTS) else - distro_info=$(fetch_distro_info $platform $JAVA_VERSION_BASE) + distro_info=$(fetch_distro_info $platform $architecture $JAVA_VERSION_BASE) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $JAVA_VERSION) fi - if [[ ! $(find_latest_cached $platform $CONCRETE_JAVA_VERSION) ]]; then + if [[ ! $(find_latest_cached $platform $architecture $CONCRETE_JAVA_VERSION) ]]; then distro_link=$(find_distro_link "$distro_info" $CONCRETE_JAVA_VERSION) - download_distro $platform $CONCRETE_JAVA_VERSION "$distro_link" + download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link" fi fi } # actually ensure required distro is in cache for target in ${TARGETS_TO_CACHE[@]}; do - ensure_distro_cached $target + ensure_distro_cached $target $X64 done +if [[ $THIS_MACHINE == $AARCH64 ]]; then + ensure_distro_cached $THIS_PLATFORM $AARCH64 +fi + UNPACKED_SUBDIR="distro" # ensures required distro uncompressed function ensure_distro_unpacked() { local platform=$1 - local version=$2 - local download_dir=$JAVA_DOWNLOAD_PATH/$platform/$version + local architecture=$2 + local version=$3 + local download_dir=$JAVA_DOWNLOAD_PATH/$platform/$architecture/$version local unpacked_dir=$download_dir/$UNPACKED_SUBDIR if [[ ! -e $download_dir/$MARKER_UNPACKED ]]; then echo "Uncompressing $JVM_IMPL-$JAVA_DISTRO_TYPE-$version-$platform" @@ -616,10 +644,15 @@ function ensure_distro_unpacked() { # actually ensure required distro uncompressed for target in ${TARGETS[@]}; do - ensure_distro_unpacked $target $CONCRETE_JAVA_VERSION + ensure_distro_unpacked $target $X64 $CONCRETE_JAVA_VERSION done -JDK_PATH=$JAVA_DOWNLOAD_PATH/$THIS_PLATFORM/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR +# actually ensure required distro for build is uncompressed when it is not x64 +if [[ $THIS_MACHINE == $AARCH64 ]]; then + ensure_distro_unpacked $THIS_PLATFORM $AARCH64 $CONCRETE_JAVA_VERSION +fi + +JDK_PATH=$JAVA_DOWNLOAD_PATH/$THIS_PLATFORM/$THIS_MACHINE/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR JLINK=$JDK_PATH/bin/jlink JDEPS=$JDK_PATH/bin/jdeps @@ -647,7 +680,8 @@ fi # creates minimized runtime for the platform function create_optimized_runtime() { local platform=$1 - local jmods=$JAVA_DOWNLOAD_PATH/$platform/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR/jmods + local machine=$2 + local jmods=$JAVA_DOWNLOAD_PATH/$platform/$machine/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR/jmods echo "Creating minimal runtime for $platform..." "$JLINK" \ --no-header-files \ @@ -655,13 +689,14 @@ function create_optimized_runtime() { --strip-debug \ --module-path "$jmods" \ --add-modules $MODULES \ - --output "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR" + --output "$BUNDLES_PATH/$platform/$machine/$BUNDLED_DISTRO_SUBDIR" fail_if $? "Failed to optimize runtime" } # creates warp bundle for the platform function create_bundle() { local platform=$1 + local machine=$2 if [[ $SILENT ]] && [[ $platform == $WIN ]]; then JAVA_EXEC=javaw @@ -674,7 +709,7 @@ function create_bundle() { create_optimized_runtime $platform ;; $DISTRO_TYPE_JRE) - mkdir -p "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR" + mkdir -p "$BUNDLES_PATH/$platform/$machine/$BUNDLED_DISTRO_SUBDIR" cp -r "$JAVA_DOWNLOAD_PATH/$platform/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR"/* \ "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR" ;; -- 2.45.2 From 8a82cca27582cf76bbb922da9cd2065514970531 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 13 May 2024 09:34:23 +0200 Subject: [PATCH 11/45] Adding binutils to docker build --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 67ee817..3ad754a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM debian:stable-slim RUN apt-get update && apt-get install -y \ + binutils \ curl \ file \ unzip \ -- 2.45.2 From c102bbe57c2db789564ed34798b797842acae1ee Mon Sep 17 00:00:00 2001 From: david Date: Mon, 13 May 2024 11:39:14 +0200 Subject: [PATCH 12/45] Printing warp-packer logs for testing --- warp4j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warp4j b/warp4j index 2ba383f..9907a86 100755 --- a/warp4j +++ b/warp4j @@ -742,7 +742,7 @@ function warp_targets() { --input_dir "$BUNDLES_PATH/$LIN" \ --exec "$LAUNCHER_NAME.sh" \ --output "$WARPED_TEMP_PATH/$LIN/$APP_NAME" \ - &> /dev/null + >&2 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" -- 2.45.2 From fb553c263b85f0e660d5969d813630007ab4b115 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 13 May 2024 16:00:13 +0200 Subject: [PATCH 13/45] Adding additional Dockerfile for x64 and updating url for warp-packer --- Dockerfile | 2 +- Dockerfile_x64_86 | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Dockerfile_x64_86 diff --git a/Dockerfile b/Dockerfile index 3ad754a..3e29398 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y \ zip \ && rm -rf /var/lib/apt/lists/* RUN curl -fsSL -o /tmp/warp-packer \ - https://git.phoenix.ipv64.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 \ + https://git.phoenix.ipv64.de/public/warp/releases/download/v0.3.0/linux-aarch64-warp-packer \ && install -D \ --mode=755 \ --owner=root \ diff --git a/Dockerfile_x64_86 b/Dockerfile_x64_86 new file mode 100644 index 0000000..7eec846 --- /dev/null +++ b/Dockerfile_x64_86 @@ -0,0 +1,20 @@ +FROM debian:stable-slim +RUN apt-get update && apt-get install -y \ + binutils \ + curl \ + file \ + unzip \ + zip \ + && rm -rf /var/lib/apt/lists/* +RUN curl -fsSL -o /tmp/warp-packer \ + https://git.phoenix.ipv64.de/public/warp/releases/download/v0.3.0/linux-x64.warp-packer \ + && install -D \ + --mode=755 \ + --owner=root \ + --group=root \ + /tmp/warp-packer \ + /usr/local/bin \ + && rm /tmp/warp-packer +WORKDIR /workdir +COPY warp4j /usr/local/bin/ +ENTRYPOINT [ "/usr/local/bin/warp4j" ] -- 2.45.2 From a5b9cf0f05dc588284bb05e2932c83f2851aca58 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 13 May 2024 16:13:13 +0200 Subject: [PATCH 14/45] Printing warp-packer logs for testing --- warp4j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/warp4j b/warp4j index 9907a86..b2a55e6 100755 --- a/warp4j +++ b/warp4j @@ -760,7 +760,7 @@ function warp_targets() { --input_dir "$BUNDLES_PATH/$MAC" \ --exec "$LAUNCHER_NAME.sh" \ --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ - &> /dev/null + >&2 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 +778,7 @@ function warp_targets() { --input_dir "$BUNDLES_PATH/$WIN" \ --exec "$LAUNCHER_NAME.cmd" \ --output "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" \ - &> /dev/null + >&2 fail_if $? "Failed to warp for $WIN" if command -v zip &> /dev/null ; then ( echo "Archiving for $WIN..." -- 2.45.2 From 760e0b814ce9d8c1e878514b033128389832a117 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 06:30:29 +0200 Subject: [PATCH 15/45] Adding new compiled warp-packer for aarch64 architecture --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3e29398..3206eca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y \ zip \ && rm -rf /var/lib/apt/lists/* RUN curl -fsSL -o /tmp/warp-packer \ - https://git.phoenix.ipv64.de/public/warp/releases/download/v0.3.0/linux-aarch64-warp-packer \ + https://git.phoenix.ipv64.de/public/warp/releases/download/v0.3.0/aarch64-linux.warp-packer \ && install -D \ --mode=755 \ --owner=root \ -- 2.45.2 From 08e3c17c3eb990617313a2258318f6578872bba8 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 09:43:52 +0200 Subject: [PATCH 16/45] 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 17/45] 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 18/45] 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 19/45] 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 20/45] 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 21/45] 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 22/45] 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 23/45] 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 24/45] 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 25/45] 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 From a6e57554354e33ecfc2dccb88eb3399f36a4d54f Mon Sep 17 00:00:00 2001 From: david Date: Thu, 16 May 2024 08:31:58 +0200 Subject: [PATCH 26/45] 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 27/45] 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 From e9509fa2c5fece0d94cb176831a0cd513f91e6cb Mon Sep 17 00:00:00 2001 From: david Date: Sun, 19 May 2024 09:48:25 +0200 Subject: [PATCH 28/45] Updating download url for new warp-packer version --- .gitignore | 1 + Dockerfile | 2 +- Dockerfile_x64_86 | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4c3a4d3..4a8b3ea 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ fatjar/ warped/ TODO.md /.project +/.settings/ diff --git a/Dockerfile b/Dockerfile index 6fb222a..26cd7c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y \ zip \ && rm -rf /var/lib/apt/lists/* RUN curl -fsSL -o /tmp/warp-packer \ - https://git.phoenix.ipv64.de/public/warp/releases/download/v0.3.0/aarch64-linux.warp-packer \ + https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-aarch64.warp-packer \ && install -D \ --mode=755 \ --owner=root \ diff --git a/Dockerfile_x64_86 b/Dockerfile_x64_86 index 7eec846..3e406cf 100644 --- a/Dockerfile_x64_86 +++ b/Dockerfile_x64_86 @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y \ zip \ && rm -rf /var/lib/apt/lists/* RUN curl -fsSL -o /tmp/warp-packer \ - https://git.phoenix.ipv64.de/public/warp/releases/download/v0.3.0/linux-x64.warp-packer \ + https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-x64.warp-packer \ && install -D \ --mode=755 \ --owner=root \ -- 2.45.2 From 401a8927bc395aa4f885b7d1a26a15036652c33a Mon Sep 17 00:00:00 2001 From: david Date: Sun, 19 May 2024 09:55:17 +0200 Subject: [PATCH 29/45] Adding test build of Dockerfile_x64_86 to pull request pipeline --- .drone.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.drone.yml b/.drone.yml index 27bce4f..a22785e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -165,6 +165,12 @@ steps: settings: dockerfile: Dockerfile +steps: +- name: warp4j x64 + <<: *default_build_option + settings: + dockerfile: Dockerfile_x64_86 + - name: *notification_name <<: *default_notification_option settings: -- 2.45.2 From 67fd83a11e91bf1209de69b004905ed626d71515 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 19 May 2024 10:03:17 +0200 Subject: [PATCH 30/45] Adding docker x64 build to testing pipeline and fixing develope pipeline --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index a22785e..061e5d2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -119,6 +119,7 @@ trigger: branch: - *branch event: + - pull_request - custom --- -- 2.45.2 From 84f132742b931a0f622591245441c344203507c0 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 19 May 2024 10:04:25 +0200 Subject: [PATCH 31/45] Fixing .drone.yml --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 061e5d2..3660d10 100644 --- a/.drone.yml +++ b/.drone.yml @@ -166,7 +166,6 @@ steps: settings: dockerfile: Dockerfile -steps: - name: warp4j x64 <<: *default_build_option settings: -- 2.45.2 From 065c993332595478506fba9aa23161d541f1a4d0 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 19 May 2024 10:37:00 +0200 Subject: [PATCH 32/45] Fixing .drone.yml --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 3660d10..22a4e0e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -56,7 +56,7 @@ trigger: branch: - *branch event: - - pull_request + - push - custom --- @@ -119,7 +119,7 @@ trigger: branch: - *branch event: - - pull_request + - push - custom --- -- 2.45.2 From e718c60a22efd88f5db1c7aec886912b7446fb48 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 08:57:25 +0200 Subject: [PATCH 33/45] Adding aarch64 support for install script --- install | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/install b/install index 355a0a5..4260ee4 100755 --- a/install +++ b/install @@ -12,10 +12,16 @@ function fail() { # platform IDs LIN=linux -LIN_URL=https://git.phoenix.ipv64.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 MAC=macos -MAC_URL=https://git.phoenix.ipv64.de/attachments/b09c6469-406a-4dd1-b5e8-1294a3aabf0f WIN=windows +# Urls +LIN_X64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-x64.warp-packer +LIN_AARCH64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-aarch64.warp-packer +MAC_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/macos-x64.warp-packer + +# platform architecture +X64=x64 +AARCH64=aarch64 # returns this platform ID function get_this_platform() { @@ -30,18 +36,39 @@ function get_this_platform() { esac } +# returns this platform architecture +function get_this_architecture() { + local this_machine="$(uname -m)" + case $this_machine in + x86_64) echo $X64 ;; + aarch64) echo $AARCH64 ;; + *) + fail_with "Unsupported machine $this_machine" + ;; + esac +} + # actually sets this platform THIS_PLATFORM=$(get_this_platform) +# actually sets this architecture +THIS_ARCHITECTURE=$(get_this_architecture) + # fetches latest release download link for the platform function get_warp_link() { local this_platform=$1 + local this_architecture=$2 if [ "$this_platform" = "$LIN" ]; then - echo "$LIN_URL" - else - echo "$MAC_URL" - fi + echo "$LIN_URL" + if [ "$this_architecture" = "$X64" ]; then + echo "$LIN_X64_URL" + else + echo "$LIN_AARCH64_URL" + fi + else + echo "$MAC_URL" + fi } # downloads and installs single binary @@ -90,7 +117,7 @@ function get_missing_deps() { WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j" echo "Getting information about warp-packer releases..." -WARP_LINK=$(get_warp_link $THIS_PLATFORM) +WARP_LINK=$(get_warp_link $THIS_PLATFORM $THIS_ARCHITECTURE) MISSING_DEPS=$(get_missing_deps) -- 2.45.2 From c00e1598425eb60dae9c9fec5fb1ef3ba9105fa1 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 09:26:10 +0200 Subject: [PATCH 34/45] Fixing install script --- install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install b/install index 4260ee4..8821855 100755 --- a/install +++ b/install @@ -77,7 +77,7 @@ function install() { local link=$2 local temp_location="/tmp/$name" echo "Downloading $name..." - curl -fsSL -o "$temp_location" "$link" + curl -fsSL -o $temp_location $link if [[ $? != 0 ]]; then echo "Error: Failed to download $name" >&2 fail @@ -92,6 +92,7 @@ function install() { echo "Error: Failed to install $name" >&2 fail fi + rm $temp_location } # returns missing dependencies -- 2.45.2 From 14e7aaf81218c3cb3853f24f1f0b098438c7bab8 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 09:32:59 +0200 Subject: [PATCH 35/45] Using install script in Dockerfile --- Dockerfile | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 26cd7c8..7547d0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,15 +5,5 @@ RUN apt-get update && apt-get install -y \ unzip \ zip \ && rm -rf /var/lib/apt/lists/* -RUN curl -fsSL -o /tmp/warp-packer \ - https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-aarch64.warp-packer \ - && install -D \ - --mode=755 \ - --owner=root \ - --group=root \ - /tmp/warp-packer \ - /usr/local/bin \ - && rm /tmp/warp-packer -WORKDIR /workdir -COPY warp4j /usr/local/bin/ +RUN ./install ENTRYPOINT [ "/usr/local/bin/warp4j" ] -- 2.45.2 From 966a3b753e696ada8b433d5572c6725b149b1062 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 09:37:00 +0200 Subject: [PATCH 36/45] Fixing Dockerfile Changing temp the url for Dockerfile Removing bash specific commands in install script Using su instead of sudo, fixing Dokcerfile --- Dockerfile | 2 +- install | 70 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7547d0b..98ad649 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,5 @@ RUN apt-get update && apt-get install -y \ unzip \ zip \ && rm -rf /var/lib/apt/lists/* -RUN ./install +RUN curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/feature/update_install_script/install | /bin/sh -s ENTRYPOINT [ "/usr/local/bin/warp4j" ] diff --git a/install b/install index 8821855..a7b9569 100755 --- a/install +++ b/install @@ -6,7 +6,7 @@ LOCATION=/usr/local/bin # exit top level program from subshell trap "exit 1" TERM export TOP_PID=$$ -function fail() { +fail() { kill -s TERM $TOP_PID } @@ -24,7 +24,7 @@ X64=x64 AARCH64=aarch64 # returns this platform ID -function get_this_platform() { +get_this_platform() { local this_platform="$(uname -s)" case $this_platform in Linux*) echo $LIN ;; @@ -37,7 +37,7 @@ function get_this_platform() { } # returns this platform architecture -function get_this_architecture() { +get_this_architecture() { local this_machine="$(uname -m)" case $this_machine in x86_64) echo $X64 ;; @@ -55,7 +55,7 @@ THIS_PLATFORM=$(get_this_platform) THIS_ARCHITECTURE=$(get_this_architecture) # fetches latest release download link for the platform -function get_warp_link() { +get_warp_link() { local this_platform=$1 local this_architecture=$2 @@ -72,23 +72,23 @@ function get_warp_link() { } # downloads and installs single binary -function install() { +install() { local name=$1 local link=$2 local temp_location="/tmp/$name" echo "Downloading $name..." curl -fsSL -o $temp_location $link - if [[ $? != 0 ]]; then + if [ $? != 0 ]; then echo "Error: Failed to download $name" >&2 fail fi echo "Creating $LOCATION/$name..." - sudo install -D \ + su -c "install -D \ --mode=755 \ --owner=root \ --group=root \ - "$temp_location" "$LOCATION" - if [[ $? != 0 ]]; then + '$temp_location' '$LOCATION'" + if [ $? != 0 ]; then echo "Error: Failed to install $name" >&2 fail fi @@ -96,23 +96,34 @@ function install() { } # returns missing dependencies -function get_missing_deps() { - local deps=( - "awk" \ - "curl" \ - "file" \ - "grep" \ - "sed" \ - "sort" \ - "tar" \ - "unzip" \ - "zip" \ - ) - for d in ${deps[@]}; do - if ! command -v $d &> /dev/null ; then - echo -n "$d " - fi - done +get_missing_deps() { + if ! command -v awk > /dev/null 2<&1; then + echo -n "awk " + fi + if ! command -v curl > /dev/null 2<&1; then + echo -n "curl " + fi + if ! command -v file > /dev/null 2<&1; then + echo -n "file " + fi + if ! command -v grep > /dev/null 2<&1; then + echo -n "grep " + fi + if ! command -v sed > /dev/null 2<&1; then + echo -n "sed " + fi + if ! command -v sort > /dev/null 2<&1; then + echo -n "sort " + fi + if ! command -v tar > /dev/null 2<&1; then + echo -n "tar " + fi + if ! command -v unzip > /dev/null 2<&1; then + echo -n "unzip " + fi + if ! command -v zip > /dev/null 2<&1; then + echo -n "zip" + fi } WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j" @@ -125,14 +136,11 @@ MISSING_DEPS=$(get_missing_deps) install "warp-packer" "$WARP_LINK" && \ install "warp4j" "$WARP4J_LINK" -if [[ -z $MISSING_DEPS ]]; then +if [ -z "$MISSING_DEPS" ]; then echo "Successfully installed" else echo "Main tools successfully installed" echo "Please install following with your package manager:" - for d in ${MISSING_DEPS[@]}; do - echo -n "$d " - done - echo + echo $MISSING_DEPS exit 1 fi -- 2.45.2 From 1e633691ff379b1b042cb98eb3846d3872b2e59e Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 15:43:18 +0200 Subject: [PATCH 37/45] Changing temporary the warp4j link --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index a7b9569..8a7695b 100755 --- a/install +++ b/install @@ -126,7 +126,7 @@ get_missing_deps() { fi } -WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j" +WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/develop/warp4j" echo "Getting information about warp-packer releases..." WARP_LINK=$(get_warp_link $THIS_PLATFORM $THIS_ARCHITECTURE) -- 2.45.2 From 3a9ea529ec6386bf2c3f40d462efee0b359bf8ef Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 17:20:54 +0200 Subject: [PATCH 38/45] Adding CHANGELOG.md and fixing Dockerfile name --- CHANGELOG.md | 22 ++++++++++++++++++++++ Dockerfile_x64_86 => Dockerfile_x64 | 0 2 files changed, 22 insertions(+) create mode 100644 CHANGELOG.md rename Dockerfile_x64_86 => Dockerfile_x64 (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9746bd3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0] - 2024-05-20 +## Added +- Install script improved to run with /bin/sh +- Dockerfile changed to use install script (Works on x64 and aarch64 architecture) +- Dockerfile_x64 with old build script for tests +- Script warp4j improved to support to run on aarch64 architecture + +## [origin warp4j] - 2019-02-28 +- See origin repository: https://github.com/guziks/warp4j + +[unreleased]: https://git.phoenix.ipv64.de/public/warp/compare/master...HEAD +[1.0.0]: https://git.phoenix.ipv64.de/GitHub_Mirrors/warp4j/compare/master...stable +[origin warp4j]: https://github.com/guziks/warp4j \ No newline at end of file diff --git a/Dockerfile_x64_86 b/Dockerfile_x64 similarity index 100% rename from Dockerfile_x64_86 rename to Dockerfile_x64 -- 2.45.2 From e35813a905f75d4367fb231e16cd3f69acc422c5 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 17:30:54 +0200 Subject: [PATCH 39/45] Fixing formatting --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9746bd3..4c87268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [1.0.0] - 2024-05-20 -## Added +### Added - Install script improved to run with /bin/sh - Dockerfile changed to use install script (Works on x64 and aarch64 architecture) - Dockerfile_x64 with old build script for tests - Script warp4j improved to support to run on aarch64 architecture -## [origin warp4j] - 2019-02-28 +### [origin warp4j] - 2019-02-28 - See origin repository: https://github.com/guziks/warp4j [unreleased]: https://git.phoenix.ipv64.de/public/warp/compare/master...HEAD -- 2.45.2 From 085535ee8474b0c80a2f857eef7d253e41aae0bf Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 17:31:18 +0200 Subject: [PATCH 40/45] Fixing formatting --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c87268..77c8622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Dockerfile_x64 with old build script for tests - Script warp4j improved to support to run on aarch64 architecture -### [origin warp4j] - 2019-02-28 +## [origin warp4j] - 2019-02-28 - See origin repository: https://github.com/guziks/warp4j [unreleased]: https://git.phoenix.ipv64.de/public/warp/compare/master...HEAD -- 2.45.2 From bb2103ebc3e15e2f00ef5ad897909cd058a09e95 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 17:33:59 +0200 Subject: [PATCH 41/45] Fixing build pipeline --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 22a4e0e..e8ff336 100644 --- a/.drone.yml +++ b/.drone.yml @@ -169,7 +169,7 @@ steps: - name: warp4j x64 <<: *default_build_option settings: - dockerfile: Dockerfile_x64_86 + dockerfile: Dockerfile_x64 - name: *notification_name <<: *default_notification_option -- 2.45.2 From d91c6f6896dbcd1b8cd0411677a6e3ac31906c7f Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 18:25:20 +0200 Subject: [PATCH 42/45] Cleaning up code and setting temporary download url to develop branch --- Dockerfile | 2 +- INSTALL.md | 19 ++++++++----------- install => install.sh | 4 +++- 3 files changed, 12 insertions(+), 13 deletions(-) rename install => install.sh (97%) diff --git a/Dockerfile b/Dockerfile index 98ad649..df5b357 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,5 @@ RUN apt-get update && apt-get install -y \ unzip \ zip \ && rm -rf /var/lib/apt/lists/* -RUN curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/feature/update_install_script/install | /bin/sh -s +RUN curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/develop/install.sh | /bin/sh -s ENTRYPOINT [ "/usr/local/bin/warp4j" ] diff --git a/INSTALL.md b/INSTALL.md index b1cf4db..8d89fcc 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,6 +2,13 @@ Here are several more ways to install `warp4j`. +## Install script +Run the [install.sh](./install.sh) script from source or use the following command: +```sh +curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install.sh | /bin/sh -s +``` + + ## Manual First install [warp-packer](https://git.phoenix.ipv64.de/public/warp/releases) and ensure other common tools available: `awk`, `curl`, `file`, `grep`, `sed`, `sort`, `tar`, `unzip`, optional: `zip`. Then install `warp4j` like this: @@ -22,14 +29,4 @@ Previous command can be also used to upgrade to the latest version. ## Docker -See docker hub [page](https://hub.docker.com/r/guziks/warp4j). - -## Moor - -Instead of direct `docker run` command you can make a launcher with [moor](https://github.com/guziks/moor): - -``` -$ moor guziks/warp4j:stable warp4j -``` - -Then use as an ordinary command. +See [Dockerfile](./Dockerfile) \ No newline at end of file diff --git a/install b/install.sh similarity index 97% rename from install rename to install.sh index 8a7695b..69b6913 100755 --- a/install +++ b/install.sh @@ -14,6 +14,7 @@ fail() { LIN=linux MAC=macos WIN=windows + # Urls LIN_X64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-x64.warp-packer LIN_AARCH64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-aarch64.warp-packer @@ -43,7 +44,8 @@ get_this_architecture() { x86_64) echo $X64 ;; aarch64) echo $AARCH64 ;; *) - fail_with "Unsupported machine $this_machine" + echo "Error: Unsupported machine $this_machine" >&2 + fail ;; esac } -- 2.45.2 From 69458b30a712a87d4de3fadd6d11cac2d7c4f071 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 19:57:06 +0200 Subject: [PATCH 43/45] Updating README.md and CHANGELOG.md --- CHANGELOG.md | 2 +- README.md | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77c8622..ef3ee3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.0] - 2024-05-20 ### Added - Install script improved to run with /bin/sh -- Dockerfile changed to use install script (Works on x64 and aarch64 architecture) +- Dockerfile changed to use install.sh script (Works on x64 and aarch64 architecture) - Dockerfile_x64 with old build script for tests - Script warp4j improved to support to run on aarch64 architecture diff --git a/README.md b/README.md index 6441bd5..4c37dce 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Just put both `warp4j` and `warp-packer` somewhere in your PATH and run `warp4j Curl one-liner installs latest versions of both `warp4j` and `warp-packer`: ``` -$ bash -c "$(curl -fsSL https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install)" +bash -c "$(curl -fsSL https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install.sh)" ``` This script will show missing dependencies (if there are any), they must be installed with your package manager. @@ -56,6 +56,7 @@ See help: ``` $ wapr4j --help + Usage: warp4j [options] Turn JAR (java archive) into self-contained executable @@ -69,10 +70,17 @@ Options: adds additional classpaths to the jdeps call --auto-class-path extract and get class-path values from jar file ignored when -cp, --class-path is set + --spring-boot extract and get class-path values from + Spring-Boot application jar file + ignored when -cp, --class-path is set -o, --output override output directory; this is relative to current PWD (default: ./warped) + -p, --prefix + if set, warp-packer will use the prefix + as target folder in which the + application should be extracted --list show available java releases; takes into consideration other options: "--java-version", "--no-optimize", "--jvm-impl"; @@ -85,13 +93,12 @@ Options: --pull check if more recent JDK/JRE distro is available; by default latest cached version that matches "--java-version" is used + to get the classpath for jdeps call --linux create binary for Linux --macos create binary for macOS --windows create binary for Windows if no targets are specified then binaries for all targets are created - --jvm-impl jvm implementation: hotspot or openj9 - (default: hotspot) --jvm-options passed to java like this: "java -jar "; @@ -99,6 +106,7 @@ Options: example: '-Xms512m -Xmx1024m' -s, --silent using javaw instead of java for windows -h, --help show this message + ``` ## Compatibility -- 2.45.2 From 0db99a4a254107e38223166fb67652fab7be54f9 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 20:29:59 +0200 Subject: [PATCH 44/45] Preparing for release --- Dockerfile | 2 +- install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index df5b357..ff4e8e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,5 @@ RUN apt-get update && apt-get install -y \ unzip \ zip \ && rm -rf /var/lib/apt/lists/* -RUN curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/develop/install.sh | /bin/sh -s +RUN curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install.sh | /bin/sh -s ENTRYPOINT [ "/usr/local/bin/warp4j" ] diff --git a/install.sh b/install.sh index 69b6913..7595434 100755 --- a/install.sh +++ b/install.sh @@ -128,7 +128,7 @@ get_missing_deps() { fi } -WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/develop/warp4j" +WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j" echo "Getting information about warp-packer releases..." WARP_LINK=$(get_warp_link $THIS_PLATFORM $THIS_ARCHITECTURE) -- 2.45.2 From f3f4cdf29d88879e11086143ca84b7a8d246769f Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 20:51:32 +0200 Subject: [PATCH 45/45] Adding PR check for master --- .drone.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index e8ff336..1b999a2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -127,7 +127,6 @@ trigger: # Variables tag: &tag testing repo: &repo phoenix.ipv64.de/kirbylink/warp4j -branch: &exclude_branch master dry_run: &dry_run true step_name: &step_name warp4j pipeline_name: &pipeline_name warp4j build only (testing) @@ -184,8 +183,5 @@ steps: status: [ success, failure ] trigger: - branch: - exclude: - - *exclude_branch event: - pull_request -- 2.45.2