forked from dotnet/orleans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild-Core.cmd
92 lines (63 loc) · 3.13 KB
/
Build-Core.cmd
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
92
@if not defined _echo @echo off
setlocal
SET CMDHOME=%~dp0.
SET BUILD_FLAGS=/m:1 /v:m /fl /flp:logfile=build.log;verbosity=detailed
:: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and
:: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69).
set Platform=
:: Restore the Tools directory
call %~dp0init-tools.cmd
if NOT [%ERRORLEVEL%]==[0] exit /b 1
set _toolRuntime=%~dp0Tools
set _dotnet=%_toolRuntime%\dotnetcli\dotnet.exe
SET PATH=%_toolRuntime%\dotnetcli;%PATH%
SET TOOLS_PACKAGES_PATH=%CMDHOME%\packages
SET SOLUTION=%CMDHOME%\Orleans.sln
:: Set DateTime suffix for debug builds
for /f %%i in ('powershell -NoProfile -ExecutionPolicy ByPass Get-Date -format "{yyyyMMddHHmm}"') do set DATE_SUFFIX=%%i
if "%1" == "Pack" GOTO :Package
@echo ===== Building %SOLUTION% =====
call %_dotnet% restore "%CMDHOME%\Build\Tools.csproj" --packages %TOOLS_PACKAGES_PATH%
@echo Build Debug ==============================
SET CURRENT_CONFIGURATION=Debug
call %_dotnet% restore /p:Configuration=%CURRENT_CONFIGURATION% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo RESTORE ok for %CURRENT_CONFIGURATION% %SOLUTION%
call %_dotnet% build %BUILD_FLAGS% /p:Configuration=%CURRENT_CONFIGURATION% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD ok for %CURRENT_CONFIGURATION% %SOLUTION%
call %_dotnet% pack --no-build %BUILD_FLAGS% /p:Configuration=%CURRENT_CONFIGURATION%;VersionDateSuffix=%DATE_SUFFIX% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo PACKAGE ok for %CURRENT_CONFIGURATION% %SOLUTION%
@echo Build Release ============================
SET CURRENT_CONFIGURATION=Release
call %_dotnet% restore /p:Configuration=%CURRENT_CONFIGURATION% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo RESTORE ok for %CURRENT_CONFIGURATION% %SOLUTION%
call %_dotnet% build %BUILD_FLAGS% /p:Configuration=%CURRENT_CONFIGURATION% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD ok for %CURRENT_CONFIGURATION% %SOLUTION%
call %_dotnet% pack --no-build %BUILD_FLAGS% /p:Configuration=%CURRENT_CONFIGURATION% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo PACKAGE ok for %CURRENT_CONFIGURATION% %SOLUTION%
goto :BuildFinished
:Package
@echo Package Debug ============================
SET CURRENT_CONFIGURATION=Debug
call %_dotnet% pack --no-build %BUILD_FLAGS% /p:Configuration=%CURRENT_CONFIGURATION%;VersionDateSuffix=%DATE_SUFFIX% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo PACKAGE ok for %CURRENT_CONFIGURATION% %SOLUTION%
@echo Package Release ============================
SET CURRENT_CONFIGURATION=Release
call %_dotnet% pack --no-build %BUILD_FLAGS% /p:Configuration=%CURRENT_CONFIGURATION% "%SOLUTION%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo PACKAGE ok for %CURRENT_CONFIGURATION% %SOLUTION%
:BuildFinished
@echo ===== Build succeeded for %SOLUTION% =====
@GOTO :EOF
:ErrorStop
set RC=%ERRORLEVEL%
if "%STEP%" == "" set STEP=%CURRENT_CONFIGURATION%
@echo ===== Build FAILED for %SOLUTION% -- %STEP% with error %RC% - CANNOT CONTINUE =====
exit /B %RC%
:EOF