forked from microsoft/microsoft-ui-xaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.cmd
175 lines (148 loc) · 4.87 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
@echo OFF
pushd %~dp0
setlocal ENABLEDELAYEDEXPANSION
if "%DevEnvDir%" == "" (
echo DevEnvDir environment variable not set. Running DevCmd.cmd to get a developer command prompt...
call %~dp0\DevCmd.cmd /PreserveContext
)
set TFS_SourcesDirectory=%~dp0
set BUILD_BINARIESDIRECTORY=%~dp0BuildOutput
set VERSIONBUILDNUMBER=local
set VERSIONBUILDREVISION=10001
set BUILDALL=
set MUXFINAL=
set PROJECTPATH=
set BUILDTARGET=
if "%1" == "" goto :usage
if "%1" == "all" (
shift
goto :ALL
)
if "%2" == "" goto :usage
REM Loose arguments
set BUILDPLATFORM=%1
if "%1" NEQ "x86" if "%1" NEQ "x64" if "%1" NEQ "arm" if "%1" NEQ "arm64" (
echo ERROR: Invalid platform "%1"
echo.
goto :usage
)
shift
set BUILDCONFIGURATION=%1
if "%1" NEQ "debug" if "%1" NEQ "release" (
echo ERROR: Invalid configuration "%1"
echo.
goto :usage
)
shift
REM echo BUILDPLATFORM=%BUILDPLATFORM% BUILDCONFIGURATION=%BUILDCONFIGURATION%
goto :MoreArguments
:ALL
REM echo Building all
set BUILDALL=1
goto :MoreArguments
:MoreArguments
if "%1" == "/muxfinal" (
REM echo MUXFinal
set MUXFINAL=1
shift
goto :MoreArguments
)
if "%1" == "/UseInsiderSDK" (
REM echo UseInsiderSDK
set USEINSIDERSDK=1
shift
goto :MoreArguments
)
if "%1" == "/UseInternalSDK" (
REM echo UseInternalSDK
set USEINTERNALSDK=1
shift
goto :MoreArguments
)
if "%1" == "/project" (
set PROJECTPATH=%~2
shift
shift
goto :MoreArguments
)
if "%1" == "/target" (
set BUILDTARGET=%BUILDTARGET% -t:%~2
shift
shift
goto :MoreArguments
)
if "%1" == "/usevsprerelease" (
set VSWHEREPARAMS=%VSWHEREPARAMS% -prerelease
shift
goto :MoreArguments
)
if "%1" NEQ "" (
echo ERROR: Unknown argument "%1"
goto :usage
)
goto :DoBuild
:DoBuild
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest %VSWHEREPARAMS% -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
set MSBUILDPATH=%%i
set MSBUILDDIRPATH=%%~dpi
IF !MSBUILDDIRPATH:~-1!==\ SET MSBUILDDIRPATH=!MSBUILDDIRPATH:~0,-1!
echo Using MSBuild from !MSBUILDPATH! in !MSBUILDDIRPATH!
)
REM
REM NUGET Restore
REM
if "%PROJECTPATH%" NEQ "" (
call .\Tools\NugetWrapper.cmd restore -MSBuildPath "%MSBUILDDIRPATH%" -NonInteractive %PROJECTPATH%
) else (
call .\Tools\NugetWrapper.cmd restore -MSBuildPath "%MSBUILDDIRPATH%" -NonInteractive .\MUXControls.sln
)
REM
REM Build Solution
REM
set PreferredToolArchitecture=x64
set EXTRAMSBUILDPARAMS=
if "%MUXFINAL%" == "1" ( set EXTRAMSBUILDPARAMS=/p:MUXFinalRelease=true )
if "%USEINSIDERSDK%" == "1" ( set EXTRAMSBUILDPARAMS=/p:UseInsiderSDK=true )
if "%USEINTERNALSDK%" == "1" ( set EXTRAMSBUILDPARAMS=/p:UseInternalSDK=true )
if "%BUILDTARGET%" NEQ "" ( set EXTRAMSBUILDPARAMS=%EXTRAMSBUILDPARAMS% %BUILDTARGET% )
if "%PROJECTPATH%" NEQ "" (
set MSBuildCommand="%MSBUILDPATH%" %PROJECTPATH% /p:platform="%BUILDPLATFORM%" /p:configuration="%BUILDCONFIGURATION%" /flp:Verbosity=Diagnostic /fl /bl %EXTRAMSBUILDPARAMS% /verbosity:Minimal /p:AppxBundle=Never /p:AppxSymbolPackageEnabled=false
echo !MSBuildCommand!
!MSBuildCommand!
) else (
if "%BUILDALL%" == "" (
"%MSBUILDPATH%" .\MUXControls.sln /p:platform="%BUILDPLATFORM%" /p:configuration="%BUILDCONFIGURATION%" /flp:Verbosity=Diagnostic /fl /bl %EXTRAMSBUILDPARAMS% /verbosity:Minimal /p:AppxBundle=Never /p:AppxSymbolPackageEnabled=false
if "%ERRORLEVEL%" == "0" call .\tools\MakeAppxHelper.cmd %BUILDPLATFORM% %BUILDCONFIGURATION%
) else (
"%MSBUILDPATH%" .\build\BuildAll.proj /maxcpucount:12 /flp:Verbosity=Diagnostic /fl /bl /verbosity:Minimal
if "%ERRORLEVEL%" == "0" (
call .\tools\MakeAppxHelper.cmd x86 release
call .\tools\MakeAppxHelper.cmd x86 debug
call .\tools\MakeAppxHelper.cmd x64 release
call .\tools\MakeAppxHelper.cmd x64 debug
call .\tools\MakeAppxHelper.cmd arm release
call .\tools\MakeAppxHelper.cmd arm debug
call .\tools\MakeAppxHelper.cmd arm64 release
call .\tools\MakeAppxHelper.cmd arm64 debug
)
)
)
goto :end
:usage
echo Usage:
echo Specific platform ^& config:
echo build.cmd ^<x86^|x64^|arm^|arm64^> ^<debug^|release^> [options]
echo.
echo All platforms ^& configs:
echo build.cmd all [options]
echo.
echo Options:
echo /leanmux - build lean mux for the store
echo /muxfinal - build "final" bits which have the winmd stripped of experimental types
echo /UseInsiderSDK - build using insider SDK
echo /UseInternalSDK - build using internal SDK
echo /project ^<path^> - builds a specific project
echo /usevsprerelease - use the prerelease VS on the machine instead of latest stable
echo /target - specify the msbuild target. Specify multiple times to build multiple targets.
echo.
:end