feat: Do not delete output directory, move new files there instead

This commit is contained in:
Serge Guzik 2019-02-12 22:33:02 +02:00
parent 72f5eaff9a
commit 87a86258c4

42
warp4j
View File

@ -264,6 +264,7 @@ BUNDLES_PATH=$CACHE_PATH/bundle # prepare bundles here
DIR="$(pwd -P)" # execution directory path DIR="$(pwd -P)" # execution directory path
WARPED_PATH=$DIR/warped # final binaries go here WARPED_PATH=$DIR/warped # final binaries go here
WARPED_TEMP_PATH=$DIR/warped-tmp # final binaries created here then moved to WARPED_PATH
BUNDLED_DISTRO_SUBDIR="java" # runtime directory inside a bundle BUNDLED_DISTRO_SUBDIR="java" # runtime directory inside a bundle
@ -570,52 +571,57 @@ done
# creates binaries and archives for all targets # creates binaries and archives for all targets
function warp_targets() { function warp_targets() {
mkdir -p $WARPED_PATH
if [[ ${TARGETS[*]} == *"$LIN"* ]]; then if [[ ${TARGETS[*]} == *"$LIN"* ]]; then
echo "Warping for $LIN..." echo "Warping for $LIN..."
mkdir -p $WARPED_PATH/$LIN mkdir -p $WARPED_TEMP_PATH/$LIN
warp-packer \ warp-packer \
--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_PATH/$LIN/$APP_NAME \ --output $WARPED_TEMP_PATH/$LIN/$APP_NAME \
&> /dev/null &> /dev/null
tar -C $WARPED_PATH/$LIN -czf $WARPED_PATH/$APP_NAME-$LIN-x64.tar.gz $APP_NAME tar -C $WARPED_TEMP_PATH/$LIN -czf $WARPED_TEMP_PATH/$APP_NAME-$LIN-x64.tar.gz $APP_NAME
mv $WARPED_PATH/$LIN/$APP_NAME $WARPED_PATH/$APP_NAME-$LIN mv $WARPED_TEMP_PATH/$LIN/$APP_NAME $WARPED_PATH/$APP_NAME-$LIN
rmdir $WARPED_PATH/$LIN mv $WARPED_TEMP_PATH/$APP_NAME-$LIN-x64.tar.gz $WARPED_PATH
rmdir $WARPED_TEMP_PATH/$LIN
fi fi
if [[ ${TARGETS[*]} == *"$MAC"* ]]; then if [[ ${TARGETS[*]} == *"$MAC"* ]]; then
echo "Warping for $MAC..." echo "Warping for $MAC..."
mkdir -p $WARPED_PATH/$MAC mkdir -p $WARPED_TEMP_PATH/$MAC
warp-packer \ warp-packer \
--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_PATH/$MAC/$APP_NAME \ --output $WARPED_TEMP_PATH/$MAC/$APP_NAME \
&> /dev/null &> /dev/null
tar -C $WARPED_PATH/$MAC -czf $WARPED_PATH/$APP_NAME-$MAC-x64.tar.gz $APP_NAME tar -C $WARPED_TEMP_PATH/$MAC -czf $WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz $APP_NAME
mv $WARPED_PATH/$MAC/$APP_NAME $WARPED_PATH/$APP_NAME-$MAC mv $WARPED_TEMP_PATH/$MAC/$APP_NAME $WARPED_PATH/$APP_NAME-$MAC
rmdir $WARPED_PATH/$MAC mv $WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz $WARPED_PATH
rmdir $WARPED_TEMP_PATH/$MAC
fi fi
if [[ ${TARGETS[*]} == *"$WIN"* ]]; then if [[ ${TARGETS[*]} == *"$WIN"* ]]; then
echo "Warping for $WIN..." echo "Warping for $WIN..."
mkdir -p $WARPED_PATH/$WIN mkdir -p $WARPED_TEMP_PATH/$WIN
warp-packer \ warp-packer \
--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_PATH/$WIN/$APP_NAME.exe \ --output $WARPED_TEMP_PATH/$WIN/$APP_NAME.exe \
&> /dev/null &> /dev/null
(cd $WARPED_PATH/$WIN (cd $WARPED_TEMP_PATH/$WIN
zip -r $WARPED_PATH/$APP_NAME-$WIN-x64.zip $APP_NAME.exe &> /dev/null zip -r $WARPED_TEMP_PATH/$APP_NAME-$WIN-x64.zip $APP_NAME.exe &> /dev/null
) )
mv $WARPED_PATH/$WIN/$APP_NAME.exe $WARPED_PATH/$APP_NAME-windows.exe mv $WARPED_TEMP_PATH/$WIN/$APP_NAME.exe $WARPED_PATH/$APP_NAME-windows.exe
rmdir $WARPED_PATH/$WIN mv $WARPED_TEMP_PATH/$APP_NAME-$WIN-x64.zip $WARPED_PATH
rmdir $WARPED_TEMP_PATH/$WIN
fi fi
rmdir $WARPED_TEMP_PATH
} }
# remove old binaries
rm -rf $WARPED_PATH
# actually create binaries and archives for all targets # actually create binaries and archives for all targets
warp_targets warp_targets