Commit ed0b7140 authored by ArnoldZokas's avatar ArnoldZokas

Build performance optimisations

parent eb1af682
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<Target Name="_Compile"> <Target Name="_Compile">
<MSBuild Projects="%(Solution.Identity)" Properties="Configuration=%(Solution.Configuration);Platform=%(Solution.Platform)" <MSBuild Projects="%(Solution.Identity)" Properties="Configuration=%(Solution.Configuration);Platform=%(Solution.Platform)"
Targets="%(Solution.BuildTarget)" BuildInParallel="true" Condition="%(Solution.CompileGroup) == $(CompileGroup)" ToolsVersion="4.0" /> Targets="%(Solution.BuildTarget)" BuildInParallel="true" Condition="%(Solution.CompileGroup) == 'Build'" />
</Target> </Target>
<Target Name="_EnsureEnvironment"> <Target Name="_EnsureEnvironment">
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<Error Text="Tool &quot;Protogen&quot; could not be found at path $(ProtogenExePath)" Condition="!Exists($(ProtogenExePath))" /> <Error Text="Tool &quot;Protogen&quot; could not be found at path $(ProtogenExePath)" Condition="!Exists($(ProtogenExePath))" />
</Target> </Target>
<Target Name="_GenerateSource" DependsOnTargets="_Clean;_Compile;_Compile"> <Target Name="_GenerateSource" DependsOnTargets="_Clean;_Compile;_EnsureEnvironment">
<PropertyGroup> <PropertyGroup>
<ProtosList>@(Protos)</ProtosList> <ProtosList>@(Protos)</ProtosList>
<Args>$(ProtosList.Replace(`;`,` `))</Args> <Args>$(ProtosList.Replace(`;`,` `))</Args>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</Target> </Target>
<Target Name="_Test" DependsOnTargets="_CompileGeneratedSource"> <Target Name="_Test" DependsOnTargets="_CompileGeneratedSource">
<Exec Command="&quot;$(NUnitExePath)&quot; %(NUnitTests.Identity) /xml=%(NUnitTests.Filename)%(NUnitTests.Extension).xml" WorkingDirectory="$(BuildTempDirectory)" /> <Exec Command="&quot;$(NUnitExePath)&quot; %(NUnitTests.Identity) /xml=%(NUnitTests.Filename)%(NUnitTests.Extension).txt" WorkingDirectory="$(BuildTempDirectory)" />
</Target> </Target>
<Target Name="_Package" DependsOnTargets="_CopyGeneratedSource"> <Target Name="_Package" DependsOnTargets="_CopyGeneratedSource">
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<!-- <!--
BENCHMARK - this needs optimising BENCHMARK - this needs optimising
--> -->
<Target Name="_GenerateBenchmarkSource"> <Target Name="_GenerateBenchmarkSource" DependsOnTargets="_Clean">
<PropertyGroup> <PropertyGroup>
<Args>$(BenchmarkProtosDirectory)\google_size.proto $(BenchmarkProtosDirectory)\google_speed.proto</Args> <Args>$(BenchmarkProtosDirectory)\google_size.proto $(BenchmarkProtosDirectory)\google_speed.proto</Args>
</PropertyGroup> </PropertyGroup>
......
write-host `nRunning build. Please wait...
$iterations = 10
for ($i=1; $i -le $iterations; $i++)
{
$sw = [System.Diagnostics.StopWatch]::StartNew()
#& $env:windir\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.csproj /m /nologo /v:q
& $env:windir\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.csproj /m /nologo /v:q /t:BuildAll /p:CompileGroup=BuildAll
$sw.Stop()
$msbuildTotalRunTime += $sw.ElapsedMilliseconds
$sw = [System.Diagnostics.StopWatch]::StartNew()
#& "..\nant-0.91-alpha2\bin\NAnt.exe" -buildfile:"..\ProtocolBuffers.build" -nologo -q clean-build
& "..\nant-0.91-alpha2\bin\NAnt.exe" -buildfile:"..\ProtocolBuffers.build" -nologo -q clean-build-all
$sw.Stop()
$nantTotalRunTime += $sw.ElapsedMilliseconds
}
write-host `nMSBuild average speed over $iterations iterations: ($msbuildTotalRunTime/$iterations) milliseconds
write-host NAnt average speed over $iterations iterations: ($nantTotalRunTime/$iterations) milliseconds`n
write-host MSBuild execution speed: ([Math]::Round($(100/$nantTotalRunTime*$msbuildTotalRunTime), 2))% "(as a percentage of NAnt execution speed)"`n
\ No newline at end of file
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<PropertyGroup> <PropertyGroup>
<ProjectName>Protocol Buffers</ProjectName> <ProjectName>Protocol Buffers</ProjectName>
<BuildConfiguration>Debug</BuildConfiguration> <BuildConfiguration>Debug</BuildConfiguration>
<CompileGroup>Build</CompileGroup> <CompileGroup>BuildAll</CompileGroup>
<VSHostExcludeWildcard>$(SourceDirectory)\**\*.vshost.exe*</VSHostExcludeWildcard>
<!--Directory Paths--> <!--Directory Paths-->
<ProjectDirectory>$(MSBuildProjectDirectory)\..</ProjectDirectory> <ProjectDirectory>$(MSBuildProjectDirectory)\..</ProjectDirectory>
...@@ -114,47 +113,50 @@ ...@@ -114,47 +113,50 @@
<PackageContents Include="$(ProjectDirectory)\protos\**\*.*"> <PackageContents Include="$(ProjectDirectory)\protos\**\*.*">
<TargetDirectory>\protos</TargetDirectory> <TargetDirectory>\protos</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\Debug\Google.ProtocolBuffers.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\Debug\Google.ProtocolBuffers.*">
<TargetDirectory>\Debug</TargetDirectory> <TargetDirectory>\Debug</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoGen\bin\Debug\ProtoGen.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoGen\bin\Debug\ProtoGen.*">
<TargetDirectory>\Debug</TargetDirectory> <TargetDirectory>\Debug</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoMunge\bin\Debug\ProtoMunge.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoMunge\bin\Debug\ProtoMunge.*">
<TargetDirectory>\Debug</TargetDirectory> <TargetDirectory>\Debug</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoDump\bin\Debug\ProtoDump.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoDump\bin\Debug\ProtoDump.*">
<TargetDirectory>\Debug</TargetDirectory> <TargetDirectory>\Debug</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoBench\bin\Debug\ProtoBench.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoBench\bin\Debug\ProtoBench.*">
<TargetDirectory>\Debug</TargetDirectory> <TargetDirectory>\Debug</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\Release\Google.ProtocolBuffers.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\Release\Google.ProtocolBuffers.*">
<TargetDirectory>\Release</TargetDirectory> <TargetDirectory>\Release</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoGen\bin\Release\ProtoGen.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoGen\bin\Release\ProtoGen.*">
<TargetDirectory>\Release</TargetDirectory> <TargetDirectory>\Release</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoMunge\bin\Release\ProtoMunge.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoMunge\bin\Release\ProtoMunge.*">
<TargetDirectory>\Release</TargetDirectory> <TargetDirectory>\Release</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoDump\bin\Release\ProtoDump.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoDump\bin\Release\ProtoDump.*">
<TargetDirectory>\Release</TargetDirectory> <TargetDirectory>\Release</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtoBench\bin\Release\ProtoBench.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtoBench\bin\Release\ProtoBench.*">
<TargetDirectory>\Release</TargetDirectory> <TargetDirectory>\Release</TargetDirectory>
</PackageContents> </PackageContents>
<PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\Silverlight2\Google.ProtocolBuffers.*" Exclude="$(VSHostExcludeWildcard)"> <PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\Silverlight2\Google.ProtocolBuffers.*">
<TargetDirectory>\Silverlight2</TargetDirectory> <TargetDirectory>\Silverlight2</TargetDirectory>
</PackageContents> </PackageContents>
<!--<PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\ReleaseCF\Google.ProtocolBuffers.*" Exclude="$(VSHostExcludeWildcard)"> <!--<PackageContents Include="$(SourceDirectory)\ProtocolBuffers\bin\ReleaseCF\Google.ProtocolBuffers.*">
<TargetDirectory>\CompactFramework35</TargetDirectory> <TargetDirectory>\CompactFramework35</TargetDirectory>
</PackageContents>--> </PackageContents>-->
<PackageContents Include="$(LibDirectory)\Protoc*">
<TargetDirectory>\Protoc</TargetDirectory>
</PackageContents>
</ItemGroup> </ItemGroup>
<!--target groups--> <!--target groups-->
<Target Name="Build" DependsOnTargets="_Clean;_Compile;_EnsureEnvironment;_GenerateSource;_CopyGeneratedSource;_CompileGeneratedSource;_Test" /> <Target Name="Build" DependsOnTargets="_GenerateSource;_CopyGeneratedSource;_CompileGeneratedSource;_Test;_Package" />
<Target Name="BuildAll" DependsOnTargets="_Clean;_Compile;_EnsureEnvironment;_GenerateSource;_CopyGeneratedSource;_CompileGeneratedSource;_Test;_Package" /> <Target Name="BuildAll" DependsOnTargets="_GenerateSource;_CopyGeneratedSource;_CompileGeneratedSource;_Test;_Package" />
<Target Name="Benchmark" DependsOnTargets="_Clean;_GenerateBenchmarkSource;_CompileBenchmarkAssembly;_PrepareBenchmarkEnvironment;_RunBenchmark" /> <Target Name="Benchmark" DependsOnTargets="_GenerateBenchmarkSource;_CompileBenchmarkAssembly;_PrepareBenchmarkEnvironment;_RunBenchmark" />
</Project> </Project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment