From 87a86258c46dd9c4f315d953e8952b8c39323cec Mon Sep 17 00:00:00 2001 From: Serge Guzik Date: Tue, 12 Feb 2019 22:33:02 +0200 Subject: [PATCH] feat: Do not delete output directory, move new files there instead --- warp4j | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/warp4j b/warp4j index ab76e58..3ec39be 100755 --- a/warp4j +++ b/warp4j @@ -264,6 +264,7 @@ BUNDLES_PATH=$CACHE_PATH/bundle # prepare bundles here DIR="$(pwd -P)" # execution directory path 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 @@ -570,52 +571,57 @@ done # creates binaries and archives for all targets function warp_targets() { + mkdir -p $WARPED_PATH + if [[ ${TARGETS[*]} == *"$LIN"* ]]; then echo "Warping for $LIN..." - mkdir -p $WARPED_PATH/$LIN + mkdir -p $WARPED_TEMP_PATH/$LIN warp-packer \ --arch linux-x64 \ --input_dir $BUNDLES_PATH/$LIN \ --exec $LAUNCHER_NAME.sh \ - --output $WARPED_PATH/$LIN/$APP_NAME \ + --output $WARPED_TEMP_PATH/$LIN/$APP_NAME \ &> /dev/null - tar -C $WARPED_PATH/$LIN -czf $WARPED_PATH/$APP_NAME-$LIN-x64.tar.gz $APP_NAME - mv $WARPED_PATH/$LIN/$APP_NAME $WARPED_PATH/$APP_NAME-$LIN - rmdir $WARPED_PATH/$LIN + tar -C $WARPED_TEMP_PATH/$LIN -czf $WARPED_TEMP_PATH/$APP_NAME-$LIN-x64.tar.gz $APP_NAME + mv $WARPED_TEMP_PATH/$LIN/$APP_NAME $WARPED_PATH/$APP_NAME-$LIN + mv $WARPED_TEMP_PATH/$APP_NAME-$LIN-x64.tar.gz $WARPED_PATH + rmdir $WARPED_TEMP_PATH/$LIN fi if [[ ${TARGETS[*]} == *"$MAC"* ]]; then echo "Warping for $MAC..." - mkdir -p $WARPED_PATH/$MAC + mkdir -p $WARPED_TEMP_PATH/$MAC warp-packer \ --arch macos-x64 \ --input_dir $BUNDLES_PATH/$MAC \ --exec $LAUNCHER_NAME.sh \ - --output $WARPED_PATH/$MAC/$APP_NAME \ + --output $WARPED_TEMP_PATH/$MAC/$APP_NAME \ &> /dev/null - tar -C $WARPED_PATH/$MAC -czf $WARPED_PATH/$APP_NAME-$MAC-x64.tar.gz $APP_NAME - mv $WARPED_PATH/$MAC/$APP_NAME $WARPED_PATH/$APP_NAME-$MAC - rmdir $WARPED_PATH/$MAC + tar -C $WARPED_TEMP_PATH/$MAC -czf $WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz $APP_NAME + mv $WARPED_TEMP_PATH/$MAC/$APP_NAME $WARPED_PATH/$APP_NAME-$MAC + mv $WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz $WARPED_PATH + rmdir $WARPED_TEMP_PATH/$MAC fi if [[ ${TARGETS[*]} == *"$WIN"* ]]; then echo "Warping for $WIN..." - mkdir -p $WARPED_PATH/$WIN + mkdir -p $WARPED_TEMP_PATH/$WIN warp-packer \ --arch windows-x64 \ --input_dir $BUNDLES_PATH/$WIN \ --exec $LAUNCHER_NAME.cmd \ - --output $WARPED_PATH/$WIN/$APP_NAME.exe \ + --output $WARPED_TEMP_PATH/$WIN/$APP_NAME.exe \ &> /dev/null - (cd $WARPED_PATH/$WIN - zip -r $WARPED_PATH/$APP_NAME-$WIN-x64.zip $APP_NAME.exe &> /dev/null + (cd $WARPED_TEMP_PATH/$WIN + 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 - rmdir $WARPED_PATH/$WIN + mv $WARPED_TEMP_PATH/$WIN/$APP_NAME.exe $WARPED_PATH/$APP_NAME-windows.exe + mv $WARPED_TEMP_PATH/$APP_NAME-$WIN-x64.zip $WARPED_PATH + rmdir $WARPED_TEMP_PATH/$WIN fi + + rmdir $WARPED_TEMP_PATH } -# remove old binaries -rm -rf $WARPED_PATH # actually create binaries and archives for all targets warp_targets