-
Notifications
You must be signed in to change notification settings - Fork 462
Expand file tree
/
Copy pathBuild.bat
More file actions
92 lines (78 loc) · 2.62 KB
/
Build.bat
File metadata and controls
92 lines (78 loc) · 2.62 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
92
@ECHO OFF
CALL "%~dp0\InitializeEnvironment.bat" || EXIT /b 10
SETLOCAL
SETLOCAL EnableDelayedExpansion
IF "%~1"=="" (
SET CONFIGURATION=Debug
) ELSE (
SET CONFIGURATION=%1
)
IF "%~2"=="" (
SET GVFSVERSION=0.2.173.2
) ELSE (
SET GVFSVERSION=%2
)
IF "%~3"=="" (
SET VERBOSITY=minimal
) ELSE (
SET VERBOSITY=%3
)
REM If we have MSBuild on the PATH then go straight to the build phase
FOR /F "tokens=* USEBACKQ" %%F IN (`where msbuild.exe`) DO (
SET MSBUILD_EXEC=%%F
ECHO INFO: Found msbuild.exe at '%%F'
GOTO :BUILD
)
:LOCATE_MSBUILD
REM Locate MSBuild via the vswhere tool
FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO (
SET NUGET_EXEC=%%F
ECHO INFO: Found nuget.exe at '%%F'
)
REM NuGet is required to be on the PATH to install vswhere
IF NOT EXIST "%NUGET_EXEC%" (
ECHO ERROR: Could not find nuget.exe on the PATH
EXIT /B 10
)
REM Acquire vswhere to find VS installations reliably
SET VSWHERE_VER=2.6.7
"%NUGET_EXEC%" install vswhere -Version %VSWHERE_VER% -OutputDirectory %VFS_PACKAGESDIR% || exit /b 1
SET VSWHERE_EXEC="%VFS_PACKAGESDIR%\vswhere.%VSWHERE_VER%\tools\vswhere.exe"
REM Use vswhere to find the latest VS installation with the MSBuild component
REM See https://github.com/Microsoft/vswhere/wiki/Find-MSBuild
FOR /F "tokens=* USEBACKQ" %%F IN (`%VSWHERE_EXEC% -all -prerelease -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\amd64\MSBuild.exe`) DO (
SET MSBUILD_EXEC=%%F
ECHO INFO: Found msbuild.exe at '%%F'
)
:BUILD
IF NOT DEFINED MSBUILD_EXEC (
ECHO ERROR: Could not locate a Visual Studio installation with required components.
ECHO Refer to Readme.md for a list of the required Visual Studio components.
EXIT /B 10
)
ECHO ^**********************
ECHO ^* Restoring Packages *
ECHO ^**********************
"%MSBUILD_EXEC%" "%VFS_SRCDIR%\GVFS.sln" ^
/t:Restore ^
/v:%VERBOSITY% ^
/p:Configuration=%CONFIGURATION% || GOTO ERROR
ECHO ^*********************
ECHO ^* Building Solution *
ECHO ^*********************
"%MSBUILD_EXEC%" "%VFS_SRCDIR%\GVFS.sln" ^
/t:Build ^
/v:%VERBOSITY% ^
/p:Configuration=%CONFIGURATION% || GOTO ERROR
GOTO :EOF
:USAGE
ECHO usage: %~n0%~x0 [^<configuration^>] [^<version^>] [^<verbosity^>]
ECHO.
ECHO configuration Solution configuration (default: Debug).
ECHO version GVFS version (default: 0.2.173.2).
ECHO verbosity MSBuild verbosity (default: minimal).
ECHO.
EXIT 1
:ERROR
ECHO ERROR: Build failed with exit code %ERRORLEVEL%
EXIT /B %ERRORLEVEL%