Skip to content

Commit 5b926d8

Browse files
authored
Merge pull request #202 from anjdreas/regenerate-pre-build
Generate code in pre-build step
2 parents efd5e49 + 211eaeb commit 5b926d8

File tree

9 files changed

+43
-95
lines changed

9 files changed

+43
-95
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.

GenerateUnits.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
@echo off
2-
powershell -ExecutionPolicy Bypass -NoProfile -File .\UnitsNet\Scripts\GenerateUnits.ps1
2+
SET scriptdir=%~dp0
3+
powershell -ExecutionPolicy Bypass -NoProfile -File %scriptdir%UnitsNet\Scripts\GenerateUnits.ps1
34
pause

UnitsNet/UnitsNet.Net35.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
4949
</ItemGroup>
5050
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
51+
<PropertyGroup>
52+
<PreBuildEvent>call $(ProjectDir)..\GenerateUnits.bat</PreBuildEvent>
53+
</PropertyGroup>
5154
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
5255
Other similar extension points exist, see Microsoft.Common.targets.
5356
<Target Name="BeforeBuild">

0 commit comments

Comments
 (0)