-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMake.bat
More file actions
91 lines (72 loc) · 2.88 KB
/
Copy pathMake.bat
File metadata and controls
91 lines (72 loc) · 2.88 KB
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
87
88
89
90
91
@echo off
setlocal
cd /d "%~dp0"
net session 1>nul 2>nul
if not "%ERRORLEVEL%"=="0" (
echo Error: Restricted access. Please run Make.bat as administrator.
goto Quit
)
git describe --abbrev=0 --tags > latestTag.txt
for /f "delims=" %%i in ('git rev-list HEAD --count') do set commitCount=%%i
set /p latestTag=<latestTag.txt
del latestTag.txt
set releaseVersion=%latestTag%.%commitCount%
if not exist "MPDN\Mpdn.Core.dll" (
echo Error: Make sure you've copied MPDN into the MPDN folder first!
goto Quit
)
rmdir /q /s bin 1>nul 2>nul
rmdir /q /s obj 1>nul 2>nul
rmdir /q /s Release 1>nul 2>nul
mkdir Release 1>nul 2>nul
set buildPlatform=Release
set zipper="%ProgramFiles%\7-zip\7z.exe"
if not exist %zipper% (
echo Error: 7-zip (native version^) is not installed
goto Quit
)
for /D %%D in (%SYSTEMROOT%\Microsoft.NET\Framework\v4*) do set msbuildexe=%%D\MSBuild.exe
if not defined msbuildexe echo error: can't find MSBuild.exe & goto Quit
if not exist "%msbuildexe%" echo error: %msbuildexe%: not found & goto Quit
Echo Making MPDN Extensions...
Echo.
del Properties\AssemblyInfo.cs.bak 1>nul 2>nul
ren Properties\AssemblyInfo.cs AssemblyInfo.cs.bak 1>nul 2>nul
del Extensions\PlayerExtensions\*.resx 1>nul 2>nul
del Extensions\RenderScripts\*.resx 1>nul 2>nul
call GenerateAssemblyInfo.bat %releaseVersion% > Properties\AssemblyInfo.cs
%msbuildexe% Mpdn.Extensions.sln /m /p:Configuration=%buildPlatform% /p:Platform="Any CPU" /v:q /t:rebuild
if not "%ERRORLEVEL%"=="0" (set builderror=1)
del Properties\AssemblyInfo.cs 1>nul 2>nul
ren Properties\AssemblyInfo.cs.bak AssemblyInfo.cs 1>nul 2>nul
Echo.
if "%builderror%"=="1" echo error: build failed & goto Quit
xcopy /y bin\Release\Mpdn.Extensions.Framework.dll Release\Extensions\ 1>nul 2>nul
xcopy /y bin\Release\Mpdn.Extensions.dll Release\Extensions\ 1>nul 2>nul
echo .cs\ > excludedfiles.txt
xcopy /y /e /exclude:excludedfiles.txt "Extensions\RenderScripts\*.*" "Release\Extensions\RenderScripts\" 1>nul 2>nul
del excludedfiles.txt
xcopy /y /e "Extensions\Libs\*.*" "Release\Extensions\Libs\" 1>nul 2>nul
xcopy /y "Extensions\README.txt" "Release\Extensions\" 1>nul 2>nul
mkdir "Release\Extensions\PlayerExtensions\"
xcopy /y /e "Extensions\PlayerExtensions\Images\*.*" "Release\Extensions\PlayerExtensions\Images\" 1>nul 2>nul
if exist Sign.bat (
echo Signing release...
Echo.
call Sign.bat Release\Extensions\Mpdn.Extensions.dll
call Sign.bat Release\Extensions\Mpdn.Extensions.Framework.dll
)
echo Zipping release...
Echo.
cd "Release"
%zipper% a -r -tzip -mx9 "%~dp0Release\Mpdn.Extensions.zip" * > NUL
rmdir /q /s Extensions 1>nul 2>nul
cd "%~dp0"
call ./Installer/Make-Installer.bat
if not "%ERRORLEVEL%"=="0" echo error: make installer failed & goto Quit
echo.
Echo All operations completed successfully.
start Release
:Quit
Echo.
Pause