Compare commits

..

11 Commits

Author SHA1 Message Date
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
2 changed files with 24 additions and 21 deletions

View File

@ -1,6 +1,5 @@
FROM debian:stable-slim
RUN apt-get update && apt-get install -y \
binutils \
curl \
file \
unzip \

44
warp4j
View File

@ -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
@ -682,14 +682,18 @@ 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..."
if [[ $JAVA_VERSION_BASE -ge 13 ]]; then
strip_debug=strip-java-debug-attributes
fi
"$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"
}
@ -706,7 +710,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"
@ -727,7 +731,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
@ -742,7 +746,7 @@ function warp_targets() {
--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 +764,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 +782,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..."
@ -792,9 +796,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
warp_targets