-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
50 lines (37 loc) · 1.05 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@echo off
:: check if PyInstaller is installed
pyinstaller >nul 2>&1
if %ERRORLEVEL% NEQ 2 (
echo PyInstaller is not installed.
echo You can install it by running "pip install pyinstaller"
exit /b 1
)
:: check if the version is specified in the arguments
if "%~1" == "" (
echo Specify the version as the first argument.
echo build X.X.X
exit /b 1
)
set "version=%1"
set "filename=TextureRestorer-%version%.zip"
mkdir tmp
cd tmp
set "iconpath=..\src\assets\arrow.ico"
set "entrypoint=..\src\TextureRestorer.py"
:: generate executable
pyinstaller --onefile --windowed --icon=%iconpath% %entrypoint%
cd ..
set "exe=.\tmp\dist\TextureRestorer.exe"
set "assets=.\src\assets"
set "data=.\src\data"
:: remove .gitkeep
del %data%\.gitkeep
:: zip files
powershell -Command "Compress-Archive -LiteralPath %exe% -DestinationPath %filename%"
powershell -Command "Compress-Archive -Path %assets%, %data% -Update -DestinationPath %filename%"
:: clean
rmdir /s /q tmp
:: create .gitkeep again
echo. 2>%data%\.gitkeep
echo.
echo Generated %filename%