Compare commits

...

67 Commits

Author SHA1 Message Date
1524ca306e Merge pull request 'release/1.0.0' (#23) from release/1.0.0 into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #23
2024-05-20 20:56:53 +02:00
david
f3f4cdf29d Adding PR check for master
Some checks failed
continuous-integration/drone/pr Build is failing
2024-05-20 20:51:32 +02:00
david
0db99a4a25 Preparing for release 2024-05-20 20:29:59 +02:00
7b7c32f56f Merge pull request 'Updating README.md and CHANGELOG.md' (#22) from feature/update_readme_file into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #22
2024-05-20 20:09:24 +02:00
david
69458b30a7 Updating README.md and CHANGELOG.md
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-20 19:57:06 +02:00
4dbfd0a8f3 Merge pull request 'Cleaning up code and setting temporary download url to develop branch' (#21) from feature/cleanup into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #21
2024-05-20 18:28:03 +02:00
david
d91c6f6896 Cleaning up code and setting temporary download url to develop branch
Some checks failed
continuous-integration/drone/pr Build is failing
2024-05-20 18:25:20 +02:00
867eb8db35 Merge pull request 'feature/updating_documentation' (#20) from feature/updating_documentation into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #20
2024-05-20 17:37:49 +02:00
david
bb2103ebc3 Fixing build pipeline
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-20 17:33:59 +02:00
david
085535ee84 Fixing formatting
Some checks failed
continuous-integration/drone/pr Build is failing
2024-05-20 17:31:18 +02:00
david
e35813a905 Fixing formatting 2024-05-20 17:30:54 +02:00
david
3a9ea529ec Adding CHANGELOG.md and fixing Dockerfile name 2024-05-20 17:20:54 +02:00
6b8ef1118e Merge pull request 'feature/update_install_script' (#19) from feature/update_install_script into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #19
2024-05-20 15:47:04 +02:00
david
1e633691ff Changing temporary the warp4j link
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-20 15:43:18 +02:00
david
966a3b753e Fixing Dockerfile
All checks were successful
continuous-integration/drone/pr Build is passing
Changing temp the url for Dockerfile
Removing bash specific commands in install script
Using su instead of sudo, fixing Dokcerfile
2024-05-20 15:29:51 +02:00
david
14e7aaf812 Using install script in Dockerfile
Some checks failed
continuous-integration/drone/pr Build is failing
2024-05-20 09:32:59 +02:00
david
c00e159842 Fixing install script 2024-05-20 09:26:10 +02:00
david
e718c60a22 Adding aarch64 support for install script 2024-05-20 08:57:25 +02:00
dd5b59e4c5 Merge pull request 'feature/Adding_docker_x64_build_to_testing_pipeline' (#18) from feature/Adding_docker_x64_build_to_testing_pipeline into develop
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Reviewed-on: #18
2024-05-19 10:39:31 +02:00
david
065c993332 Fixing .drone.yml
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-19 10:37:00 +02:00
david
84f132742b Fixing .drone.yml
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-19 10:04:25 +02:00
david
67fd83a11e Adding docker x64 build to testing pipeline and fixing develope pipeline 2024-05-19 10:03:17 +02:00
david
401a8927bc Adding test build of Dockerfile_x64_86 to pull request pipeline 2024-05-19 09:55:17 +02:00
eaee10a147 Merge pull request 'Updating download url for new warp-packer version' (#17) from feature/using_new_warp_packer into develop
Reviewed-on: #17
2024-05-19 09:51:04 +02:00
david
e9509fa2c5 Updating download url for new warp-packer version
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-19 09:48:25 +02:00
e8e9e246b6 Merge pull request 'feature/updating_warp-packer_and_adding_optional_prefix_parameter' (#16) from feature/updating_warp-packer_and_adding_optional_prefix_parameter into develop
Reviewed-on: #16
2024-05-17 22:58:42 +02:00
david
3073a732f6 Updating warp-packer call, adding prefix and Spring-Boot support
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-17 22:56:20 +02:00
david
a6e5755435 Adding prefix parameter to warp4j 2024-05-16 08:31:58 +02:00
d548761372 Merge pull request 'Fixing multiple errors' (#15) from feature/debugging_build_step into develop
Reviewed-on: #15
2024-05-15 11:15:04 +02:00
david
1b57d73186 Reverting changes for debugging
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-15 11:09:36 +02:00
david
9712e0ebaf Fixing variable
All checks were successful
continuous-integration/drone Build is passing
2024-05-15 07:45:21 +02:00
david
bfe5a0c3b5 Fixing variable
All checks were successful
continuous-integration/drone Build is passing
2024-05-15 07:21:25 +02:00
david
b140323b61 Using correct comparator
All checks were successful
continuous-integration/drone Build is passing
2024-05-15 07:00:56 +02:00
david
51337c59d0 Removing binutils and using correct strip depending on java version
All checks were successful
continuous-integration/drone Build is passing
2024-05-15 06:46:06 +02:00
david
8f442e0e50 Using temporary older version of plugins/docker
All checks were successful
continuous-integration/drone Build is passing
2024-05-14 21:59:32 +02:00
david
f0e904b9fb Debug drone messages
Some checks failed
continuous-integration/drone Build is failing
2024-05-14 21:31:13 +02:00
david
f27ede1ee9 Fixing missing parameter
Some checks reported errors
continuous-integration/drone Build was killed
2024-05-14 20:00:43 +02:00
david
d8af2f5402 Debugging build step
Some checks failed
continuous-integration/drone Build is failing
2024-05-14 19:29:48 +02:00
david
08e3c17c3e Debugging build step
All checks were successful
continuous-integration/drone Build is passing
2024-05-14 09:43:52 +02:00
ea6ea677bc Merge pull request 'Adding new compiled warp-packer for aarch64 architecture' (#14) from feature/using_updated_aarch64_warp_packer into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #14
2024-05-14 06:33:16 +02:00
david
760e0b814c Adding new compiled warp-packer for aarch64 architecture
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-14 06:30:29 +02:00
8b73944d0c Merge pull request 'Printing warp-packer logs for testing' (#13) from feature/enabling_warp_packer_logs_for_testing into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #13
2024-05-13 16:14:59 +02:00
david
a5b9cf0f05 Printing warp-packer logs for testing
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-13 16:13:13 +02:00
811686bba7 Merge pull request 'Adding additional Dockerfile for x64 and updating url for warp-packer' (#12) from feature/using_aarch64_warp-packer into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #12
2024-05-13 16:03:39 +02:00
david
fb553c263b Adding additional Dockerfile for x64 and updating url for warp-packer
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-13 16:00:13 +02:00
3c2ac97134 Merge pull request 'Printing warp-packer logs for testing' (#11) from feature/enabling_warp_packer_logs_for_testing into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #11
2024-05-13 11:41:36 +02:00
david
c102bbe57c Printing warp-packer logs for testing
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-13 11:39:14 +02:00
5190f4dfc7 Merge pull request 'Adding binutils to docker build' (#10) from feature/adding_binutils_to_build into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #10
2024-05-13 09:38:09 +02:00
david
8a82cca275 Adding binutils to docker build
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-13 09:34:23 +02:00
e1f937bb2c Merge pull request 'Adding support to build x64 application on linux aarch64 architecture' (#9) from feature/support_arm_as_build_system_for_x64 into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #9
2024-05-13 08:08:31 +02:00
david
83e17c9c42 Adding support to build x64 application on linux aarch64 architecture
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-13 08:05:17 +02:00
64bdcfc7a9 Merge pull request 'Fixing typo in .drone.yml' (#8) from feature/fixing_typo into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #8
2024-05-12 09:21:18 +02:00
david
897fc83880 Fixing typo in .drone.yml
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-12 09:19:32 +02:00
d9b7157471 Merge pull request 'Feature: Adding test build for testing images' (#7) from feature/add_testing_image_to_build_options into develop
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #7
2024-05-12 09:15:17 +02:00
david
7a930d7def Feature: Adding test build for testing images
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-12 09:13:20 +02:00
d8a7589e5e Merge pull request 'Feature: Remove jvm-impl choice since Adoptium only offers hotspot impl' (#6) from feature/remove_jvm_impl_choice into develop
Reviewed-on: #6
2024-05-12 08:51:49 +02:00
david
1b395c6c68 Feature: Remove jvm-impl choice since Adoptium only offers hotspot impl
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-12 08:48:01 +02:00
cfcff034c4 Merge pull request 'Feature: Fixing name in .drone.yml' (#5) from feature/fixing_warp4j_names_for_build into develop
Reviewed-on: #5
2024-05-12 08:40:19 +02:00
david
f463391e0f Feature: Fixing name in .drone.yml
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-12 08:11:28 +02:00
bce7315995 Merge pull request 'feature/add_drone_support' (#4) from feature/add_drone_support into develop
Reviewed-on: #4
2024-05-12 00:29:49 +02:00
david
5d03fbe45e Feature: Changing from push to pull_request event
All checks were successful
continuous-integration/drone/pr Build is passing
2024-05-12 00:15:44 +02:00
david
21cf3c330b Feature: Adding first draft of .drone.yml.
Some checks reported errors
continuous-integration/drone Build was killed
continuous-integration/drone/push Build is passing
2024-05-11 23:55:00 +02:00
cb03fbf739 Merge pull request 'feature/using_new_adoptium_url' (#3) from feature/using_new_adoptium_url into develop
Reviewed-on: #3
2024-05-11 21:16:57 +02:00
241aae92b4 Merge pull request 'Feature: Updating to new domain name' (#2) from feature/update_domain into develop
Reviewed-on: #2
2024-05-11 21:15:59 +02:00
david
3352169028 Feature: Fixing class-path 2024-05-11 21:07:27 +02:00
david
d15b451319 Feature: Updating url and parser to fetch from Adoptium 2024-05-11 20:16:48 +02:00
david
938ac7f33d Feature: Updating to new domain name 2024-05-11 09:09:28 +02:00
11 changed files with 520 additions and 249 deletions

187
.drone.yml Normal file
View File

@ -0,0 +1,187 @@
# Variables
tag: &tag latest
repo: &repo phoenix.ipv64.de/kirbylink/warp4j
branch: &branch master
dry_run: &dry_run false
step_name: &step_name warp4j
pipeline_name: &pipeline_name warp4j build and push
notification_name: &notification_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/warp4j
branch: &branch develop
dry_run: &dry_run false
step_name: &step_name warp4j
pipeline_name: &pipeline_name warp4j build and push (testing)
notification_name: &notification_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:
- push
- custom
---
# Variables
tag: &tag testing
repo: &repo phoenix.ipv64.de/kirbylink/warp4j
dry_run: &dry_run true
step_name: &step_name warp4j
pipeline_name: &pipeline_name warp4j build only (testing)
notification_name: &notification_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: warp4j x64
<<: *default_build_option
settings:
dockerfile: Dockerfile_x64
- 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:
event:
- pull_request

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ fatjar/
warped/ warped/
TODO.md TODO.md
/.project /.project
/.settings/

22
CHANGELOG.md Normal file
View File

@ -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.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
## [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

View File

@ -5,15 +5,5 @@ RUN apt-get update && apt-get install -y \
unzip \ unzip \
zip \ zip \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL -o /tmp/warp-packer \ RUN curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install.sh | /bin/sh -s
https://git.kirby-link.dd-dns.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 \
&& 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" ] ENTRYPOINT [ "/usr/local/bin/warp4j" ]

View File

@ -1,12 +1,13 @@
FROM debian:stable-slim FROM debian:stable-slim
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
binutils \
curl \ curl \
file \ file \
unzip \ unzip \
zip \ zip \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL -o /tmp/warp-packer \ RUN curl -fsSL -o /tmp/warp-packer \
https://github.com/dgiagio/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 \ && install -D \
--mode=755 \ --mode=755 \
--owner=root \ --owner=root \
@ -14,14 +15,6 @@ RUN curl -fsSL -o /tmp/warp-packer \
/tmp/warp-packer \ /tmp/warp-packer \
/usr/local/bin \ /usr/local/bin \
&& rm /tmp/warp-packer && 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 WORKDIR /workdir
COPY warp4j /usr/local/bin/
ENTRYPOINT [ "/usr/local/bin/warp4j" ] ENTRYPOINT [ "/usr/local/bin/warp4j" ]

View File

@ -2,13 +2,20 @@
Here are several more ways to install `warp4j`. 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 ## 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 \ $ 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 \ TEMP_LOCATION=/tmp/warp4j \
bash -c 'curl -fsSL -o $TEMP_LOCATION $LINK && \ bash -c 'curl -fsSL -o $TEMP_LOCATION $LINK && \
sudo install -D \ sudo install -D \
@ -22,14 +29,4 @@ Previous command can be also used to upgrade to the latest version.
## Docker ## Docker
See docker hub [page](https://hub.docker.com/r/guziks/warp4j). See [Dockerfile](./Dockerfile)
## 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.

View File

@ -6,7 +6,7 @@ Turn JAR (java archive) into self-contained executable in a single command.
- downloads java runtimes automatically - downloads java runtimes automatically
- makes runtimes optimized for your application - 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) - works on Linux, macOS and Windows (with Windows Subsystem for Linux)
- supports cross "compilation" - supports cross "compilation"
- does not require neither JDK nor JRE installed - 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`: 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.sh)"
``` ```
This script will show missing dependencies (if there are any), they must be installed with your package manager. 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 $ wapr4j --help
Usage: warp4j [options] <app.jar> Usage: warp4j [options] <app.jar>
Turn JAR (java archive) into self-contained executable Turn JAR (java archive) into self-contained executable
@ -69,10 +70,17 @@ Options:
adds additional classpaths to the jdeps call adds additional classpaths to the jdeps call
--auto-class-path extract and get class-path values from jar file --auto-class-path extract and get class-path values from jar file
ignored when -cp, --class-path is set 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 <directory> -o, --output <directory>
override output directory; override output directory;
this is relative to current PWD this is relative to current PWD
(default: ./warped) (default: ./warped)
-p, --prefix <prefix>
if set, warp-packer will use the prefix
as target folder in which the
application should be extracted
--list show available java releases; --list show available java releases;
takes into consideration other options: takes into consideration other options:
"--java-version", "--no-optimize", "--jvm-impl"; "--java-version", "--no-optimize", "--jvm-impl";
@ -85,13 +93,12 @@ Options:
--pull check if more recent JDK/JRE distro is available; --pull check if more recent JDK/JRE distro is available;
by default latest cached version that matches by default latest cached version that matches
"--java-version" is used "--java-version" is used
to get the classpath for jdeps call
--linux create binary for Linux --linux create binary for Linux
--macos create binary for macOS --macos create binary for macOS
--windows create binary for Windows --windows create binary for Windows
if no targets are specified then binaries for if no targets are specified then binaries for
all targets are created all targets are created
--jvm-impl jvm implementation: hotspot or openj9
(default: hotspot)
--jvm-options <options> --jvm-options <options>
passed to java like this: passed to java like this:
"java <options> -jar <jar file>"; "java <options> -jar <jar file>";
@ -99,6 +106,7 @@ Options:
example: '-Xms512m -Xmx1024m' example: '-Xms512m -Xmx1024m'
-s, --silent using javaw instead of java for windows -s, --silent using javaw instead of java for windows
-h, --help show this message -h, --help show this message
``` ```
## Compatibility ## Compatibility

View File

@ -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 on host>:/cache \
--volume <jars on host>:/workdir \
--user $(id -u):$(id -g) \
guziks/warp4j:stable <app.jar>
```
Change according to your requirements, but volume with working directory is mandatory.

110
install
View File

@ -1,110 +0,0 @@
#!/usr/bin/env bash
# install location
LOCATION=/usr/local/bin
# exit top level program from subshell
trap "exit 1" TERM
export TOP_PID=$$
function fail() {
kill -s TERM $TOP_PID
}
# platform IDs
LIN=linux
LIN_URL=https://git.kirby-link.dd-dns.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760
MAC=macos
MAC_URL=https://git.kirby-link.dd-dns.de/attachments/b09c6469-406a-4dd1-b5e8-1294a3aabf0f
WIN=windows
# returns this platform ID
function get_this_platform() {
local this_platform="$(uname -s)"
case $this_platform in
Linux*) echo $LIN ;;
Darwin*) echo $MAC ;;
*)
echo "Error: Unsupported platform $this_platform" >&2
fail
;;
esac
}
# actually sets this platform
THIS_PLATFORM=$(get_this_platform)
# fetches latest release download link for the platform
function get_warp_link() {
local this_platform=$1
if [ "$this_platform" = "$LIN" ]; then
echo "$LIN_URL"
else
echo "$MAC_URL"
fi
}
# downloads and installs single binary
function install() {
local name=$1
local link=$2
local temp_location="/tmp/$name"
echo "Downloading $name..."
curl -fsSL -o "$temp_location" "$link"
if [[ $? != 0 ]]; then
echo "Error: Failed to download $name" >&2
fail
fi
echo "Creating $LOCATION/$name..."
sudo install -D \
--mode=755 \
--owner=root \
--group=root \
"$temp_location" "$LOCATION"
if [[ $? != 0 ]]; then
echo "Error: Failed to install $name" >&2
fail
fi
}
# 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
}
WARP4J_LINK="https://git.kirby-link.dd-dns.de/public/warp4j/raw/branch/master/warp4j"
echo "Getting information about warp-packer releases..."
WARP_LINK=$(get_warp_link $THIS_PLATFORM)
MISSING_DEPS=$(get_missing_deps)
install "warp-packer" "$WARP_LINK" && \
install "warp4j" "$WARP4J_LINK"
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
exit 1
fi

148
install.sh Executable file
View File

@ -0,0 +1,148 @@
#!/usr/bin/env bash
# install location
LOCATION=/usr/local/bin
# exit top level program from subshell
trap "exit 1" TERM
export TOP_PID=$$
fail() {
kill -s TERM $TOP_PID
}
# platform IDs
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
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
get_this_platform() {
local this_platform="$(uname -s)"
case $this_platform in
Linux*) echo $LIN ;;
Darwin*) echo $MAC ;;
*)
echo "Error: Unsupported platform $this_platform" >&2
fail
;;
esac
}
# returns this platform architecture
get_this_architecture() {
local this_machine="$(uname -m)"
case $this_machine in
x86_64) echo $X64 ;;
aarch64) echo $AARCH64 ;;
*)
echo "Error: Unsupported machine $this_machine" >&2
fail
;;
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
get_warp_link() {
local this_platform=$1
local this_architecture=$2
if [ "$this_platform" = "$LIN" ]; then
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
install() {
local name=$1
local link=$2
local temp_location="/tmp/$name"
echo "Downloading $name..."
curl -fsSL -o $temp_location $link
if [ $? != 0 ]; then
echo "Error: Failed to download $name" >&2
fail
fi
echo "Creating $LOCATION/$name..."
su -c "install -D \
--mode=755 \
--owner=root \
--group=root \
'$temp_location' '$LOCATION'"
if [ $? != 0 ]; then
echo "Error: Failed to install $name" >&2
fail
fi
rm $temp_location
}
# returns missing dependencies
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"
echo "Getting information about warp-packer releases..."
WARP_LINK=$(get_warp_link $THIS_PLATFORM $THIS_ARCHITECTURE)
MISSING_DEPS=$(get_missing_deps)
install "warp-packer" "$WARP_LINK" && \
install "warp4j" "$WARP4J_LINK"
if [ -z "$MISSING_DEPS" ]; then
echo "Successfully installed"
else
echo "Main tools successfully installed"
echo "Please install following with your package manager:"
echo $MISSING_DEPS
exit 1
fi

219
warp4j
View File

@ -15,10 +15,17 @@ function print_help {
echo ' adds additional classpaths to the jdeps call' echo ' adds additional classpaths to the jdeps call'
echo ' --auto-class-path extract and get class-path values from jar file' echo ' --auto-class-path extract and get class-path values from jar file'
echo ' ignored when -cp, --class-path is set' echo ' ignored when -cp, --class-path is set'
echo ' --spring-boot extract and get class-path values from'
echo ' Spring-Boot application jar file'
echo ' ignored when -cp, --class-path is set'
echo ' -o, --output <directory>' echo ' -o, --output <directory>'
echo ' override output directory;' echo ' override output directory;'
echo ' this is relative to current PWD' echo ' this is relative to current PWD'
echo ' (default: ./warped)' echo ' (default: ./warped)'
echo ' -p, --prefix <prefix>'
echo ' if set, warp-packer will use the prefix'
echo ' as target folder in which the '
echo ' application should be extracted'
echo ' --list show available java releases;' echo ' --list show available java releases;'
echo ' takes into consideration other options:' echo ' takes into consideration other options:'
echo ' "--java-version", "--no-optimize", "--jvm-impl";' echo ' "--java-version", "--no-optimize", "--jvm-impl";'
@ -37,8 +44,6 @@ function print_help {
echo ' --windows create binary for Windows' echo ' --windows create binary for Windows'
echo ' if no targets are specified then binaries for' echo ' if no targets are specified then binaries for'
echo ' all targets are created' echo ' all targets are created'
echo ' --jvm-impl jvm implementation: hotspot or openj9'
echo ' (default: hotspot)'
echo ' --jvm-options <options>' echo ' --jvm-options <options>'
echo ' passed to java like this:' echo ' passed to java like this:'
echo ' "java <options> -jar <jar file>";' echo ' "java <options> -jar <jar file>";'
@ -63,7 +68,7 @@ function fail_with() {
fail fail
} }
# if error code is not zero fail with a message # if error code is not zero fail with a message
function fail_if() { function fail_if() {
local error_code=$1 local error_code=$1
local message=$2 local message=$2
@ -95,6 +100,22 @@ function get_this_platform() {
esac 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 # show help if no arguments specified
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
print_help print_help
@ -114,6 +135,14 @@ while [[ $# -gt 0 ]]; do
CLASS_PATH="$2" CLASS_PATH="$2"
shift 2 shift 2
;; ;;
--auto-class-path)
AUTO_CLASS_PATH=true
shift
;;
--spring-boot)
SPRING_BOOT_APPLICATION=true
shift
;;
-j|--java-version) -j|--java-version)
JAVA_VERSION="$2" JAVA_VERSION="$2"
JAVA_VERSION_OVERRIDEN=true JAVA_VERSION_OVERRIDEN=true
@ -123,6 +152,10 @@ while [[ $# -gt 0 ]]; do
OUTPUT_DIR_PATH="$2" OUTPUT_DIR_PATH="$2"
shift 2 shift 2
;; ;;
-p|--prefix)
PREFIX="--prefix $2"
shift 2
;;
--list) --list)
LIST_RELEASES=true LIST_RELEASES=true
shift shift
@ -147,18 +180,10 @@ while [[ $# -gt 0 ]]; do
TARGETS+=($WIN) TARGETS+=($WIN)
shift shift
;; ;;
--jvm-impl)
JVM_IMPL="$2"
shift 2
;;
--jvm-options) --jvm-options)
JVM_OPTIONS="$2" JVM_OPTIONS="$2"
shift 2 shift 2
;; ;;
--auto-class-path)
AUTO_CLASS_PATH=true
shift
;;
-s|--silent) -s|--silent)
SILENT=true SILENT=true
shift shift
@ -175,10 +200,11 @@ done
set -- "${POSITIONAL[@]}" # restore positional arguments set -- "${POSITIONAL[@]}" # restore positional arguments
THIS_PLATFORM=$(get_this_platform) THIS_PLATFORM=$(get_this_platform)
THIS_MACHINE=$(get_this_machine)
# checks if all dependencies are available # checks if all dependencies are available
function check_deps() { function check_deps() {
local deps=( local deps=(
"awk" \ "awk" \
"curl" \ "curl" \
"file" \ "file" \
@ -231,22 +257,13 @@ if [[ $JAVA_VERSION ]] && ! java_version_is_correct $JAVA_VERSION ; then
fail_with "JDK version \"$JAVA_VERSION\" is not correct" fail_with "JDK version \"$JAVA_VERSION\" is not correct"
fi fi
JVM_IMPL_HOTSPOT=hotspot JVM_IMPL=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
LATEST_LTS=17 # latest LTS java branch LATEST_LTS=17 # latest LTS java branch
# default options # default options
test -z $JAVA_VERSION && JAVA_VERSION=$LATEST_LTS test -z $JAVA_VERSION && JAVA_VERSION=$LATEST_LTS
test -z $TARGETS && TARGETS=($LIN $MAC $WIN) test -z $TARGETS && TARGETS=($LIN $MAC $WIN)
test -z $JVM_IMPL && JVM_IMPL=$JVM_IMPL_HOTSPOT
# returns java branch version # returns java branch version
function get_base_version() { function get_base_version() {
@ -273,27 +290,28 @@ function choose_distro_type() {
# actually choose distro type # actually choose distro type
JAVA_DISTRO_TYPE=$(choose_distro_type) JAVA_DISTRO_TYPE=$(choose_distro_type)
# generates adoptopenjdk api url # generates adoptium api url
function api_url() { function api_url() {
local request=$1 # info/binary local platform=$1 # windows/linux/macos
local platform=$2 # windows/linux/macos local architecture=$2
# adoptopenjdk uses "mac" instead of "macos" # adoptium uses "mac" instead of "macos"
if [[ $platform == "macos" ]]; then if [[ $platform == "macos" ]]; then
platform="mac" platform="mac"
fi fi
echo -n "https://api.adoptopenjdk.net/v2/\
$request/releases/openjdk$JAVA_VERSION_BASE?\ echo -n "https://api.adoptium.net/v3/assets/feature_releases/\
openjdk_impl=$JVM_IMPL&\ $JAVA_VERSION_BASE/ga?architecture=$architecture&heap_size=normal&image_type=jdk&\
os=$platform&\ os=$platform&page=0&page_size=20&project=$JAVA_DISTRO_TYPE&\
arch=x64&\ sort_method=DEFAULT&sort_order=DESC&vendor=eclipse"
type=$JAVA_DISTRO_TYPE"
} }
# requests info about all releases for given platform and java branch # requests info about all releases for given platform and java branch
function fetch_distro_info() { function fetch_distro_info() {
local platform=$1 # platform ID local platform=$1 # platform ID
local branch=$2 # 8/9/10/11... local architecture=$2
curl -s $(api_url info $platform) local branch=$3 # 8/9/10/11...
curl -s $(api_url $platform $architecture)
fail_if $? "Failed to fetch java $branch info" fail_if $? "Failed to fetch java $branch info"
} }
@ -323,7 +341,7 @@ function list_releases() {
local matched local matched
local printed local printed
local platform="linux" # just picked any 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) matched=$(find_matched_versions "$info" $JAVA_VERSION)
if [[ $matched ]]; then if [[ $matched ]]; then
echo "Releases that match $JAVA_VERSION:" echo "Releases that match $JAVA_VERSION:"
@ -344,8 +362,8 @@ if [[ $LIST_RELEASES ]]; then
exit exit
fi fi
JAR_FILE_BASE_NAME=$(basename -- "$JAR") # "my-app.jAr" 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_EXTENSION_LOWERCASE=$(printf "%s" "$JAR_EXTENSION" | tr '[:upper:]' '[:lower:]') # "jar"
JAR_NAME="${JAR_FILE_BASE_NAME%.*}" # "my-app" JAR_NAME="${JAR_FILE_BASE_NAME%.*}" # "my-app"
@ -365,9 +383,10 @@ if ([[ $(file $JAR) != *"Java"* ]] && # it could be "Java archive data" or "Java
fi fi
# even if this platform is not targeted, we still need # 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[@]} 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[@]} != *"$THIS_PLATFORM"* ]]; then # and this platform is not targeted
TARGETS_TO_CACHE+=($THIS_PLATFORM) TARGETS_TO_CACHE+=($THIS_PLATFORM)
fi fi
@ -417,7 +436,7 @@ JAVA=$DIR/$JAVA_DIST/bin/'"$JAVA_EXEC"'
JAR_PATH=$DIR/$JAR JAR_PATH=$DIR/$JAR
exec "$JAVA" '"$JVM_OPTIONS"' -jar "$JAR_PATH" "$@" exec "$JAVA" '"$JVM_OPTIONS"' -jar "$JAR_PATH" "$@"
' '
} }
# prints a launcher for windows cmd # prints a launcher for windows cmd
@ -435,7 +454,7 @@ SET "JAR_PATH=%~dp0\%JAR%"
START %JAVA% '"$JVM_OPTIONS"' -jar %JAR_PATH% %* START %JAVA% '"$JVM_OPTIONS"' -jar %JAR_PATH% %*
EXIT /B %ERRORLEVEL% EXIT /B %ERRORLEVEL%
' '
} }
# these files are success markers # these files are success markers
@ -445,8 +464,9 @@ MARKER_UNPACKED="unpacked" # after runtime uncompress
# returns latest cached version that matches version specified by user # returns latest cached version that matches version specified by user
function find_latest_cached() { function find_latest_cached() {
local platform=$1 local platform=$1
local user_version=$2 local architecture=$2
local platform_dir=$JAVA_DOWNLOAD_PATH/$platform/ 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" # turning something like "11.0.1+13" into regexp like "^11\.0\.1\+13"
local pattern="^"$(echo $user_version \ local pattern="^"$(echo $user_version \
| sed -e 's/\./\\\./g' -e 's/\+/\\\+/g') | sed -e 's/\./\\\./g' -e 's/\+/\\\+/g')
@ -469,7 +489,7 @@ function find_latest_cached() {
# finds latest concrete distro version that matches version specified by user # finds latest concrete distro version that matches version specified by user
function find_latest_version() { 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 user_version=$2 # version supplied by user is a template
local matched_version # latest version that matches the template local matched_version # latest version that matches the template
local versions # all versions local versions # all versions
@ -495,12 +515,11 @@ function find_latest_version() {
# finds direct link to download concrete runtime version # finds direct link to download concrete runtime version
function find_distro_link() { 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 version=$2 # concrete distro version like "11.0.2+9"
local link=$(echo "$info" \ local link=$(echo "$info" \
| grep -B13 "\"heap_size\": \"normal\"" \ | grep -B14 "\"release_name\": \"jdk-$version\"" \
| grep -B11 "\"semver\": \"$version\"" \ | grep "\"link\":" \
| grep "binary_link" \
| sort --reverse \ | sort --reverse \
| head -n 1 \ | head -n 1 \
| awk '{print $2}' \ | awk '{print $2}' \
@ -514,9 +533,11 @@ function find_distro_link() {
# downloads runtime distro # downloads runtime distro
function download_distro() { function download_distro() {
local platform=$1 local platform=$1
local version=$2 local architecture=$2
local link=$3 local version=$3
local download_dir=$JAVA_DOWNLOAD_PATH/$platform/$version 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..." echo "Downloading $JVM_IMPL-$JAVA_DISTRO_TYPE-$version-$platform..."
rm -rf "$download_dir" rm -rf "$download_dir"
mkdir -p "$download_dir" mkdir -p "$download_dir"
@ -530,58 +551,64 @@ function download_distro() {
) )
} }
# ensures required distro is in cache # ensures required distro is in cache
function ensure_distro_cached() { function ensure_distro_cached() {
local platform=$1 local platform=$1
local architecture=$2
local distro_info local distro_info
local distro_link local distro_link
if [[ -z $PULL ]]; then if [[ -z $PULL ]]; then
if [[ -z $JAVA_VERSION_OVERRIDEN ]]; then if [[ -z $JAVA_VERSION_OVERRIDEN ]]; then
if [[ ! $(find_latest_cached $platform $LATEST_LTS) ]]; then if [[ ! $(find_latest_cached $platform $architecture $LATEST_LTS) ]]; 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) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $LATEST_LTS)
distro_link=$(find_distro_link "$distro_info" $CONCRETE_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 else
CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $LATEST_LTS) CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $LATEST_LTS)
fi fi
else else
if [[ ! $(find_latest_cached $platform $JAVA_VERSION) ]]; then if [[ ! $(find_latest_cached $platform $architecture $JAVA_VERSION) ]]; then
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) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $JAVA_VERSION)
distro_link=$(find_distro_link "$distro_info" $CONCRETE_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 else
CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $JAVA_VERSION) CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $JAVA_VERSION)
fi fi
fi fi
else else
if [[ -z $JAVA_VERSION ]]; then 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) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $LATEST_LTS)
else 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) CONCRETE_JAVA_VERSION=$(find_latest_version "$distro_info" $JAVA_VERSION)
fi 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) 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
fi fi
} }
# actually ensure required distro is in cache # actually ensure required distro is in cache
for target in ${TARGETS_TO_CACHE[@]}; do for target in ${TARGETS_TO_CACHE[@]}; do
ensure_distro_cached $target ensure_distro_cached $target $X64
done done
if [[ $THIS_MACHINE == $AARCH64 ]]; then
ensure_distro_cached $THIS_PLATFORM $AARCH64
fi
UNPACKED_SUBDIR="distro" UNPACKED_SUBDIR="distro"
# ensures required distro uncompressed # ensures required distro uncompressed
function ensure_distro_unpacked() { function ensure_distro_unpacked() {
local platform=$1 local platform=$1
local version=$2 local architecture=$2
local download_dir=$JAVA_DOWNLOAD_PATH/$platform/$version local version=$3
local download_dir=$JAVA_DOWNLOAD_PATH/$platform/$architecture/$version
local unpacked_dir=$download_dir/$UNPACKED_SUBDIR local unpacked_dir=$download_dir/$UNPACKED_SUBDIR
if [[ ! -e $download_dir/$MARKER_UNPACKED ]]; then if [[ ! -e $download_dir/$MARKER_UNPACKED ]]; then
echo "Uncompressing $JVM_IMPL-$JAVA_DISTRO_TYPE-$version-$platform" echo "Uncompressing $JVM_IMPL-$JAVA_DISTRO_TYPE-$version-$platform"
@ -630,12 +657,17 @@ function ensure_distro_unpacked() {
fi fi
} }
# actually ensure required distro uncompressed # actually ensure required distro uncompressed
for target in ${TARGETS[@]}; do for target in ${TARGETS[@]}; do
ensure_distro_unpacked $target $CONCRETE_JAVA_VERSION ensure_distro_unpacked $target $X64 $CONCRETE_JAVA_VERSION
done 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 JLINK=$JDK_PATH/bin/jlink
JDEPS=$JDK_PATH/bin/jdeps JDEPS=$JDK_PATH/bin/jdeps
@ -653,6 +685,12 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then
echo "Extracting jar file to get classpath" echo "Extracting jar file to get classpath"
unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}" unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}"
echo "Fetching modules" echo "Fetching modules"
MODULES=$($JDEPS --ignore-missing-deps --print-module-deps --recursive --multi-release $JAVA_VERSION_BASE -quiet --class-path=${EXTRACTED_JAR_PATH}/* --module-path=${EXTRACTED_JAR_PATH}/* $JAR | grep -v Warning)
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) MODULES=$($JDEPS --ignore-missing-deps --print-module-deps --recursive --multi-release $JAVA_VERSION_BASE -quiet --class-path=${EXTRACTED_JAR_PATH}/BOOT-INF/lib/* --module-path=${EXTRACTED_JAR_PATH}/BOOT-INF/lib/BOOT-INF/lib/* $JAR | grep -v Warning)
else else
echo "Fetch modules with default behavior" echo "Fetch modules with default behavior"
@ -663,12 +701,17 @@ fi
# creates minimized runtime for the platform # creates minimized runtime for the platform
function create_optimized_runtime() { function create_optimized_runtime() {
local platform=$1 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
local strip_debug=strip-debug
echo "Creating minimal runtime for $platform..." echo "Creating minimal runtime for $platform..."
if [[ $JAVA_VERSION_BASE -ge 13 ]]; then
strip_debug=strip-java-debug-attributes
fi
"$JLINK" \ "$JLINK" \
--no-header-files \ --no-header-files \
--no-man-pages \ --no-man-pages \
--strip-debug \ --$strip_debug \
--module-path "$jmods" \ --module-path "$jmods" \
--add-modules $MODULES \ --add-modules $MODULES \
--output "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR" --output "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR"
@ -678,6 +721,7 @@ function create_optimized_runtime() {
# creates warp bundle for the platform # creates warp bundle for the platform
function create_bundle() { function create_bundle() {
local platform=$1 local platform=$1
local machine=$2
if [[ $SILENT ]] && [[ $platform == $WIN ]]; then if [[ $SILENT ]] && [[ $platform == $WIN ]]; then
JAVA_EXEC=javaw JAVA_EXEC=javaw
@ -687,10 +731,10 @@ function create_bundle() {
case $JAVA_DISTRO_TYPE in case $JAVA_DISTRO_TYPE in
$DISTRO_TYPE_JDK) $DISTRO_TYPE_JDK)
create_optimized_runtime $platform create_optimized_runtime $platform $machine
;; ;;
$DISTRO_TYPE_JRE) $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"/* \ cp -r "$JAVA_DOWNLOAD_PATH/$platform/$CONCRETE_JAVA_VERSION/$UNPACKED_SUBDIR"/* \
"$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR" "$BUNDLES_PATH/$platform/$BUNDLED_DISTRO_SUBDIR"
;; ;;
@ -708,7 +752,7 @@ function create_bundle() {
rm -rf "$BUNDLES_PATH" rm -rf "$BUNDLES_PATH"
# actually create bundles for all targets # actually create bundles for all targets
for target in ${TARGETS[@]}; do for target in ${TARGETS[@]}; do
create_bundle $target create_bundle $target $X64
done done
# creates binaries and archives for all targets # creates binaries and archives for all targets
@ -719,8 +763,11 @@ function warp_targets() {
echo "Warping for $LIN..." echo "Warping for $LIN..."
mkdir -p "$WARPED_TEMP_PATH/$LIN" mkdir -p "$WARPED_TEMP_PATH/$LIN"
warp-packer \ warp-packer \
pack \
--unique-id \
$PREFIX \
--arch linux-x64 \ --arch linux-x64 \
--input_dir "$BUNDLES_PATH/$LIN" \ --input-dir "$BUNDLES_PATH/$LIN" \
--exec "$LAUNCHER_NAME.sh" \ --exec "$LAUNCHER_NAME.sh" \
--output "$WARPED_TEMP_PATH/$LIN/$APP_NAME" \ --output "$WARPED_TEMP_PATH/$LIN/$APP_NAME" \
&> /dev/null &> /dev/null
@ -737,8 +784,11 @@ function warp_targets() {
echo "Warping for $MAC..." echo "Warping for $MAC..."
mkdir -p "$WARPED_TEMP_PATH/$MAC" mkdir -p "$WARPED_TEMP_PATH/$MAC"
warp-packer \ warp-packer \
pack \
--unique-id \
$PREFIX \
--arch macos-x64 \ --arch macos-x64 \
--input_dir "$BUNDLES_PATH/$MAC" \ --input-dir "$BUNDLES_PATH/$MAC" \
--exec "$LAUNCHER_NAME.sh" \ --exec "$LAUNCHER_NAME.sh" \
--output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \
&> /dev/null &> /dev/null
@ -755,8 +805,11 @@ function warp_targets() {
echo "Warping for $WIN..." echo "Warping for $WIN..."
mkdir -p "$WARPED_TEMP_PATH/$WIN" mkdir -p "$WARPED_TEMP_PATH/$WIN"
warp-packer \ warp-packer \
pack \
--unique-id \
$PREFIX \
--arch windows-x64 \ --arch windows-x64 \
--input_dir "$BUNDLES_PATH/$WIN" \ --input-dir "$BUNDLES_PATH/$WIN" \
--exec "$LAUNCHER_NAME.cmd" \ --exec "$LAUNCHER_NAME.cmd" \
--output "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" \ --output "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" \
&> /dev/null &> /dev/null
@ -773,9 +826,9 @@ function warp_targets() {
mv "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" "$WARPED_PATH/$APP_NAME-windows-x64.exe" mv "$WARPED_TEMP_PATH/$WIN/$APP_NAME.exe" "$WARPED_PATH/$APP_NAME-windows-x64.exe"
rmdir "$WARPED_TEMP_PATH/$WIN" rmdir "$WARPED_TEMP_PATH/$WIN"
fi fi
rmdir "$WARPED_TEMP_PATH" rmdir "$WARPED_TEMP_PATH"
} }
# actually create binaries and archives for all targets # actually create binaries and archives for all targets
warp_targets warp_targets