release/1.0.0 #23
28
warp4j
28
warp4j
@ -61,7 +61,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
|
||||||
@ -189,7 +189,7 @@ 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" \
|
||||||
@ -348,7 +348,7 @@ if [[ $LIST_RELEASES ]]; then
|
|||||||
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"
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ 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 [[ $THIS_MACHINE == $X64 ]] && # if architecture is x86
|
if [[ $THIS_MACHINE == $X64 ]] && # if architecture is x86
|
||||||
[[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]] && # and if using JDK (not JRE)
|
[[ $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
|
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
|
||||||
@ -439,7 +439,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
|
||||||
@ -536,7 +536,7 @@ 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 architecture=$2
|
||||||
@ -551,7 +551,7 @@ function ensure_distro_cached() {
|
|||||||
download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link"
|
download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link"
|
||||||
else
|
else
|
||||||
CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $LATEST_LTS)
|
CONCRETE_JAVA_VERSION=$(find_latest_cached $platform $architecture $LATEST_LTS)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ ! $(find_latest_cached $platform $architecture $JAVA_VERSION) ]]; then
|
if [[ ! $(find_latest_cached $platform $architecture $JAVA_VERSION) ]]; then
|
||||||
distro_info=$(fetch_distro_info $platform $architecture $JAVA_VERSION_BASE)
|
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"
|
download_distro $platform $architecture $CONCRETE_JAVA_VERSION "$distro_link"
|
||||||
else
|
else
|
||||||
CONCRETE_JAVA_VERSION=$(find_latest_cached $architecture $platform $JAVA_VERSION)
|
CONCRETE_JAVA_VERSION=$(find_latest_cached $architecture $platform $JAVA_VERSION)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ -z $JAVA_VERSION ]]; then
|
if [[ -z $JAVA_VERSION ]]; then
|
||||||
@ -588,7 +588,7 @@ 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 architecture=$2
|
local architecture=$2
|
||||||
@ -642,7 +642,7 @@ 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 $X64 $CONCRETE_JAVA_VERSION
|
ensure_distro_unpacked $target $X64 $CONCRETE_JAVA_VERSION
|
||||||
done
|
done
|
||||||
@ -685,7 +685,7 @@ function create_optimized_runtime() {
|
|||||||
local strip_debug=strip-debug
|
local strip_debug=strip-debug
|
||||||
echo "Creating minimal runtime for $platform..."
|
echo "Creating minimal runtime for $platform..."
|
||||||
if [[ $JAVA_VERSION_BASE -ge 13 ]]; then
|
if [[ $JAVA_VERSION_BASE -ge 13 ]]; then
|
||||||
$strip_debug=strip-java-debug-attributes
|
strip_debug=strip-java-debug-attributes
|
||||||
fi
|
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" \
|
"$JLINK" \
|
||||||
@ -798,9 +798,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
|
||||||
|
Loading…
Reference in New Issue
Block a user