This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Build.bat
86 lines (65 loc) · 2.72 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@echo off
set RAR="C:\Program Files\WinRAR\WinRAR.exe"
set VCVARSALL="%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
set DEVENV="devenv.exe"
set ISS="%ProgramFiles(x86)%\Inno Setup 5\iscc.exe"
call %VCVARSALL% x86
rmdir /s /q "%~dp0\mRemoteV2\bin" > nul 2>&1
rmdir /s /q "%~dp0\mRemoteV2\obj" > nul 2>&1
if exist "%~dp0\mRemoteV2\bin" goto ERROR_RMDIR
if exist "%~dp0\mRemoteV2\obj" goto ERROR_RMDIR
goto NOERROR_RMDIR
:ERROR_RMDIR
echo.
echo Could not clean output directories.
echo.
echo Build process failed.
echo.
goto END
:NOERROR_RMDIR
echo Building release version...
%DEVENV% "%~dp0\mRemoteV2.sln" /build "Release"
echo Building portable version...
%DEVENV% "%~dp0\mRemoteV2.sln" /build "Release Portable"
mkdir "%~dp0\Release" > nul 2>&1
del /f /q "%~dp0\Release\*.*" > nul 2>&1
if not exist %ISS% goto ERROR_ISS
goto NOERROR_ISS
:ERROR_ISS
echo.
echo Inno Setup not found.
echo.
echo Build process failed.
echo.
goto END
:NOERROR_ISS
%ISS% "%~dp0\Installer\mRemoteNC.iss"
for /F %%a in ('dir /b .\Release\mRemoteNC-Installer-*.exe') do set FileName=%%~na
set PortableZipName=%FileName:Installer=Portable%.zip
set ReleaseZipName=%FileName:-Installer=%.zip
set InstallerZipName=%FileName%.zip
set InstallerReleaseName=%FileName%.exe
set AioName=%FileName%-AIO.zip
echo Creating portable ZIP file...
del /f /q "%~dp0\Release\%PortableZipName%" > nul 2>&1
%RAR% a -ibck -m5 -r -ep1 -afzip -inul "%~dp0\Release\%PortableZipName%" "%~dp0\mRemoteV2\bin\Release Portable\*.*"
%RAR% a -ibck -m5 -r -ep1 -afzip -inul "%~dp0\Release\%PortableZipName%" "%~dp0\Installer\Dependencies\*.*"
echo Creating release ZIP file...
del /f /q "%~dp0\Release\%ReleaseZipName%" > nul 2>&1
%RAR% a -ibck -m5 -r -ep1 -afzip -inul "%~dp0\Release\%ReleaseZipName%" "%~dp0\mRemoteV2\bin\Release\*.*"
%RAR% a -ibck -m5 -r -ep1 -afzip -inul "%~dp0\Release\%ReleaseZipName%" "%~dp0\Installer\Dependencies\*.*"
echo Creating installer ZIP file...
del /f /q "%~dp0\Release\%InstallerZipName%" > nul 2>&1
%RAR% a -ibck -m5 -r -ep1 -afzip -inul "%~dp0\Release\%InstallerZipName%" "%~dp0.\Release\%InstallerReleaseName%"
echo Creating AIO ZIP file...
del /f /q "%~dp0\Release\%AioName%" > nul 2>&1
%RAR% a -ibck -m5 -r -ep1 -afzip -inul "%~dp0\Release\%AioName%" "%~dp0\Release\%PortableZipName%"
%RAR% a -ibck -m5 -r -ep1 -afzip -inul "%~dp0\Release\%AioName%" "%~dp0\Release\%InstallerReleaseName%"
copy "%~dp0\Release\%AioName%" "%~dp0\Release\mRemoteNC-AIO-Latest.zip"
copy "%~dp0\Release\%PortableZipName%" "%~dp0\Release\mRemoteNC-Portable-Latest.zip"
copy "%~dp0\Release\%InstallerReleaseName%" "%~dp0\Release\mRemoteNC-Installer-Latest.exe"
echo.
echo Finished!
echo.
:END
pause