forked from microsoft/Mobius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.cmd
78 lines (54 loc) · 1.85 KB
/
Build.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
@setlocal
@ECHO off
rem
rem Copyright (c) Microsoft. All rights reserved.
rem Licensed under the MIT license. See LICENSE file in the project root for full license information.
rem
SET CMDHOME=%~dp0
@REM Remove trailing backslash \
set CMDHOME=%CMDHOME:~0,-1%
@REM Set msbuild location.
SET VisualStudioVersion=12.0
if EXIST "%VS140COMNTOOLS%" SET VisualStudioVersion=14.0
SET MSBUILDEXEDIR=%programfiles(x86)%\MSBuild\%VisualStudioVersion%\Bin
if NOT EXIST "%MSBUILDEXEDIR%\." SET MSBUILDEXEDIR=%programfiles%\MSBuild\%VisualStudioVersion%\Bin
SET MSBUILDEXE=%MSBUILDEXEDIR%\MSBuild.exe
SET MSBUILDOPT=/verbosity:minimal
if "%builduri%" == "" set builduri=Build.cmd
cd "%CMDHOME%"
@cd
set PROJ_NAME=Examples
set PROJ=%CMDHOME%\%PROJ_NAME%.sln
@echo ===== Building %PROJ% =====
@echo Restore NuGet packages ===================
SET STEP=NuGet-Restore
nuget restore "%PROJ%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo Build Debug ==============================
SET STEP=Debug
SET CONFIGURATION=%STEP%
SET STEP=%CONFIGURATION%
"%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% %MSBUILDOPT% "%PROJ%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD ok for %CONFIGURATION% %PROJ%
@echo Build Release ============================
SET STEP=Release
SET CONFIGURATION=%STEP%
"%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% %MSBUILDOPT% "%PROJ%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD ok for %CONFIGURATION% %PROJ%
if EXIST %PROJ_NAME%.nuspec (
@echo ===== Build NuGet package for %PROJ% =====
SET STEP=NuGet-Pack
powershell -f %CMDHOME%\..\build\localmode\nugetpack.ps1
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo NuGet package ok for %PROJ%
)
@echo ===== Build succeeded for %PROJ% =====
@GOTO :EOF
:ErrorStop
set RC=%ERRORLEVEL%
if "%STEP%" == "" set STEP=%CONFIGURATION%
@echo ===== Build FAILED for %PROJ% -- %STEP% with error %RC% - CANNOT CONTINUE =====
exit /B %RC%
:EOF