forked from Gallio/mbunit-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.bat
50 lines (39 loc) · 1.33 KB
/
Build.bat
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
@if defined ECHO (echo %ECHO%) else (echo off)
REM
REM Builds everything and drops it into the Build folder.
REM
setlocal
set ROOT_DIR=%~dp0
set MSBUILD_ARGS=%*
if not defined MSBUILD_ARGS (
echo Must specify a module to build such as "packages\Bundle Package.module".
exit /b 1
)
call :FIND_MSBUILD %SystemRoot%\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe
call :FIND_MSBUILD %SystemRoot%\Microsoft.Net\Framework\v3.5\MSBuild.exe
if not defined MSBUILD (
echo Could not find path to MSBuild.exe.
exit /b 1
)
call :SANITIZE ROOT_DIR
"%MSBUILD%" /nologo /clp:NoSummary /p:"RootDir=%ROOT_DIR%" %MSBUILD_ARGS%
if errorlevel 1 (
echo Failed!
exit /b 1
)
exit /b 0
REM Sanitizes a path by converting it to a full path without a trailing backslash.
REM We do this because the .Net command parser handles sequences like '\"' by taking the
REM quote literally. This causes problems when specifying MSBuild property values
REM unless we remove or double-up the trailing backslash.
:SANITIZE
if not defined %~1 exit /b 0
for /F "tokens=*" %%V in ('echo %%%~1%%') do set SANITIZE_TEMP=%%~dpnxV
if "%SANITIZE_TEMP:~-1%"=="\" set SANITIZE_TEMP=%SANITIZE_TEMP:~0,-1%
set %~1=%SANITIZE_TEMP%
set SANITIZE_TEMP=
exit /b 0
:FIND_MSBUILD
if defined MSBUILD exit /b 0
if exist "%~1" set MSBUILD=%~1
exit /b 0