-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cmd
50 lines (36 loc) · 1.01 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
@ECHO off & setlocal enableextensions enabledelayedexpansion
:: Debug|Release
SET CONFIGURATION=Release
:: strlen("\scripts\") => 9
SET APP_HOME=%~dp0
SET APP_HOME=%APP_HOME:~0,-9%
cd %APP_HOME%
:: Check dependencies
dotnet --version > NUL 2>&1
IF %ERRORLEVEL% NEQ 0 GOTO MISSING_DOTNET
:: Restore nuget packages and compile the application
echo Downloading dependencies...
call dotnet restore
IF %ERRORLEVEL% NEQ 0 GOTO FAIL
echo Compiling code...
call dotnet build --configuration %CONFIGURATION%
IF %ERRORLEVEL% NEQ 0 GOTO FAIL
:: Find all the test assemblies and run the tests
echo Running tests...
for /d %%i in (*.Test) do (
dotnet test %%i\%%i.csproj
IF !ERRORLEVEL! NEQ 0 GOTO FAIL
)
goto :END
:: - - - - - - - - - - - - - -
:MISSING_DOTNET
echo ERROR: 'dotnet' command not found.
echo Install .NET Core 2 and make sure the 'dotnet' command is in the PATH.
echo Nuget installation: https://dotnet.github.io/
exit /B 1
:FAIL
echo Command failed
endlocal
exit /B 1
:END
endlocal