diff --git a/build.bat b/build.bat index 691060e..75ed6cb 100644 --- a/build.bat +++ b/build.bat @@ -15,11 +15,54 @@ GOTO comment_end ECHO. +:: ----------------------------------------------------------------------------------------------------- +:: +:: Powershell zip compression +:: Compress-Archive -Path "ntfy-electron-win32-x64" -DestinationPath "build/ntfy-electron-windows-x64.zip" +:: +:: Windows tar.exe Compression +:: tar.exe does not support .zip compression. File must be .tar.gz +:: +:: -r Recursive +:: -q Quiet mode +:: -9 compression ratio +:: +:: TAR -cf archive-file.tar.gz [filenames...] +:: TAR -cf "build/ntfy-electron-windows-x64.tar.gz" "ntfy-electron-win32-x64" +:: ----------------------------------------------------------------------------------------------------- + +:: ----------------------------------------------------------------------------------------------------- +:: define: misc +:: ----------------------------------------------------------------------------------------------------- + +set bDeleteBuild=true + :: ----------------------------------------------------------------------------------------------------- :: define: directories :: ----------------------------------------------------------------------------------------------------- set dir_home=%~dp0 +set dir_build=build +set dir_dist=dist + +:: ----------------------------------------------------------------------------------------------------- +:: Create build directory +:: +:: /build contains built electron package +:: /dist contains zip archive +:: ----------------------------------------------------------------------------------------------------- + +IF exist !dir_build! ( + echo Folder !dir_build! already exists +) ELSE ( + md !dir_build! && echo Folder !dir_build! created +) + +IF exist !dir_dist! ( + echo Folder !dir_dist! already exists +) ELSE ( + md !dir_dist! && echo Folder !dir_dist! created +) :: ----------------------------------------------------------------------------------------------------- :: define: platforms @@ -32,19 +75,34 @@ set platformMac=x64 arm64 for %%a in (%platformWin%) do ( echo. echo Building windows-%%a - CALL electron-packager . ntfy-electron --asar --platform="win32" --arch="%%a" --icon="ntfy.ico" --overwrite --ignore=^/build --prune=true --out=dist --appCopyright="Copyright (c) 2024" --win32metadata.FileDescription="ntfy desktop client with Electron wrapper" --win32metadata.ProductName="ntfy desktop" --win32metadata.OriginalFilename="ntfy-desktop.exe" --win32metadata.CompanyName="https://github.com/xdpirate/ntfy-electron" + CALL electron-packager . ntfy-electron --asar --platform="win32" --arch="%%a" --icon="ntfy.ico" --overwrite --ignore=\"(!dir_dist!*|!dir_build!*|.github*|.all-contributorsrc|.editorconfig|.eslintrc|.git*|.npm*|.prettier*)\" --prune=true --out=!dir_build! --appCopyright="Copyright (c) 2024" --win32metadata.FileDescription="ntfy desktop client with Electron wrapper" --win32metadata.ProductName="ntfy desktop" --win32metadata.OriginalFilename="ntfy-desktop.exe" --win32metadata.CompanyName="https://github.com/xdpirate/ntfy-electron" + powershell Compress-Archive -Path "!dir_build!/ntfy-electron-win32-%%a" -DestinationPath "!dir_dist!/ntfy-electron-windows-%%a.zip" + + if "!bDeleteBuild!" == "true" ( + rm -rf "!dir_build!/ntfy-electron-win32-%%a" + ) ) for %%a in (%platformLinux%) do ( echo. echo Building linux-%%a - CALL electron-packager . ntfy-electron --asar --platform="linux" --arch="%%a" --icon="ntfy.png" --overwrite --ignore=^/build --prune=true --out=dist --appCopyright="Copyright (c) 2024" --win32metadata.FileDescription="ntfy desktop client with Electron wrapper" --win32metadata.ProductName="ntfy desktop" --win32metadata.OriginalFilename="ntfy-desktop.exe" --win32metadata.CompanyName="https://github.com/xdpirate/ntfy-electron" + CALL electron-packager . ntfy-electron --asar --platform="linux" --arch="%%a" --icon="ntfy.png" --overwrite --ignore=\"(!dir_dist!*|!dir_build!*|.github*|.all-contributorsrc|.editorconfig|.eslintrc|.git*|.npm*|.prettier*)\" --prune=true --out=!dir_build! --appCopyright="Copyright (c) 2024" --win32metadata.FileDescription="ntfy desktop client with Electron wrapper" --win32metadata.ProductName="ntfy desktop" --win32metadata.OriginalFilename="ntfy-desktop.exe" --win32metadata.CompanyName="https://github.com/xdpirate/ntfy-electron" + powershell Compress-Archive -Path "!dir_build!/ntfy-electron-linux-%%a" -DestinationPath "!dir_dist!/ntfy-electron-linux-%%a.zip" + + if "!bDeleteBuild!" == "true" ( + rm -rf "!dir_build!/ntfy-electron-linux-%%a" + ) ) for %%a in (%platformMac%) do ( echo. echo Building linux-%%a - CALL electron-packager . ntfy-electron --asar --platform="darwin" --arch="%%a" --icon="ntfy.icns" --overwrite --ignore=^/build --prune=true --out=dist --appCopyright="Copyright (c) 2024" --win32metadata.FileDescription="ntfy desktop client with Electron wrapper" --win32metadata.ProductName="ntfy desktop" --win32metadata.OriginalFilename="ntfy-desktop.exe" --win32metadata.CompanyName="https://github.com/xdpirate/ntfy-electron" + CALL electron-packager . ntfy-electron --asar --platform="darwin" --arch="%%a" --icon="ntfy.icns" --overwrite --ignore=\"(!dir_dist!*|!dir_build!*|.github*|.all-contributorsrc|.editorconfig|.eslintrc|.git*|.npm*|.prettier*)\" --prune=true --out=!dir_build! --appCopyright="Copyright (c) 2024" --win32metadata.FileDescription="ntfy desktop client with Electron wrapper" --win32metadata.ProductName="ntfy desktop" --win32metadata.OriginalFilename="ntfy-desktop.exe" --win32metadata.CompanyName="https://github.com/xdpirate/ntfy-electron" + powershell Compress-Archive -Path "!dir_build!/ntfy-electron-darwin-%%a" -DestinationPath "!dir_dist!/ntfy-electron-mac-%%a.zip" + + if "!bDeleteBuild!" == "true" ( + rm -rf "!dir_build!/ntfy-electron-darwin-%%a" + ) ) goto :END