Skip to content

Commit 211eaeb

Browse files
committed
build.bat: Build src and tests in one go
Pre-build step was ran twice, and generally the setup of .msbuild files were unnecessarily complex. Simplified by building source and tests in one go via all.msbuild and defining relative paths directly instead of paths.msbuild. * Add all.msbuild * Remove obsolete .msbuild files: src, tests, paths * Rename to build-all-release/debug.bat * build.bat: Remove call to GenerateUnits.bat, called by pre-build step
1 parent fbd44fd commit 211eaeb

File tree

7 files changed

+38
-94
lines changed

7 files changed

+38
-94
lines changed

Build/all.msbuild

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CompileProjects" ToolsVersion="14.0">
3+
4+
<PropertyGroup>
5+
<Platform>AnyCPU</Platform>
6+
<Configuration>Release</Configuration>
7+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
8+
<RootPath>$(MSBuildProjectDirectory)\..\</RootPath>
9+
</PropertyGroup>
10+
11+
<Target Name="CleanAndBuild" DependsOnTargets="Clean;CompileProjects" />
12+
13+
<Target Name="Clean">
14+
<MSBuild Projects="@(AllProjects)" Targets="Clean" />
15+
<RemoveDir Directories="$(SrcBinPath)" />
16+
</Target>
17+
18+
<Target Name="CompileProjects">
19+
<MSBuild Projects="
20+
$(RootPath)\UnitsNet\UnitsNet.Net35.csproj;
21+
$(RootPath)\UnitsNet\UnitsNet.Portable40.csproj;
22+
$(RootPath)\UnitsNet\UnitsNet.NetStandard10.csproj;
23+
$(RootPath)\UnitsNet\UnitsNet.WindowsRuntimeComponent.csproj;
24+
$(RootPath)\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Net35.csproj;
25+
$(RootPath)\UnitsNet.Tests\UnitsNet.Tests.csproj;
26+
$(RootPath)\UnitsNet.Tests\UnitsNet.WindowsRuntimeComponent.Tests.csproj;
27+
$(RootPath)\UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj"
28+
29+
Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion)"
30+
Targets="Build">
31+
</MSBuild>
32+
</Target>
33+
34+
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
SET ROOT=%~dp0..
2-
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\src.msbuild /verbosity:normal /p:Configuration=Debug /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
2+
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\all.msbuild /verbosity:normal /p:Configuration=Debug /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
33
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@echo off
22
SET ROOT=%~dp0..
3-
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\src.msbuild /verbosity:normal /p:Configuration=Release /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
3+
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\all.msbuild /verbosity:normal /p:Configuration=Release /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
44
if %errorlevel% neq 0 exit /b %errorlevel%

Build/build.bat

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
@echo off
22
SET ROOT=%~dp0..
3+
34
if exist %ROOT%\Artifacts rmdir /Q /S %ROOT%\Artifacts
45

56
call powershell -NoProfile %ROOT%\Build\UpdateAssemblyInfo.ps1
67
if %errorlevel% neq 0 exit /b %errorlevel%
78

8-
call powershell -ExecutionPolicy Bypass -NoProfile -File %ROOT%\UnitsNet\Scripts\GenerateUnits.ps1
9-
if %errorlevel% neq 0 exit /b %errorlevel%
10-
119
call %ROOT%\Build\nuget-restore.bat
1210
if %errorlevel% neq 0 exit /b %errorlevel%
1311

14-
call %ROOT%\Build\build-src-release.bat
15-
if %errorlevel% neq 0 exit /b %errorlevel%
16-
17-
call %ROOT%\Build\build-tests.bat
12+
call %ROOT%\Build\build-all-release.bat
1813
if %errorlevel% neq 0 exit /b %errorlevel%
1914

2015
call %ROOT%\Build\run-tests.bat

Build/paths.msbuild

Lines changed: 0 additions & 26 deletions
This file was deleted.

Build/src.msbuild

Lines changed: 0 additions & 30 deletions
This file was deleted.

Build/tests.msbuild

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)