Skip to content

Commit

Permalink
Add build batch file
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Whewell committed Feb 13, 2020
1 parent bdf4b13 commit 30a4348
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@echo off

set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe"
if not exist %MSBUILD% set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
if exist %MSBUILD% goto :BUILD

echo Cannot find msbuild.exe
exit /b 1

:BUILD
set SOLUTION="%~dp0opensky-to-basestation.sln"

echo Cleaning binaries
call "%~dp0Clean.bat"
echo.

echo Restoring NuGet packages
%MSBUILD% -t:restore %SOLUTION%
IF ERRORLEVEL 1 GOTO :ELERROR
echo.

echo Building debug configuration
%MSBUILD% -t:build -property:Configuration=Debug %SOLUTION%
IF ERRORLEVEL 1 GOTO :ELERROR
echo.

echo Building release configuration
%MSBUILD% -t:build -property:Configuration=Release %SOLUTION%
IF ERRORLEVEL 1 GOTO :ELERROR
echo.

goto :END

:ELERROR
echo The last command returned a non-zero error level. The build failed.
exit /b 1

:END
exit /b 0
2 changes: 2 additions & 0 deletions Clean.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
powershell -ExecutionPolicy Bypass -File "%~dp0CleanObjAndBin.ps1" -sourceRoot %~dp0
10 changes: 10 additions & 0 deletions CleanObjAndBin.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
param(
[Parameter(Mandatory=$True)]
$sourceRoot
)

Write-Output "Removing obj folders from $sourceRoot"
Dir -Path "$sourceRoot" obj -Directory -Recurse | Remove-Item -Force -Recurse

Write-Output "Removing bin folders from $sourceRoot"
Dir -Path "$sourceRoot" bin -Directory -Recurse | Remove-Item -Force -Recurse

0 comments on commit 30a4348

Please sign in to comment.