diff --git a/.hgignore b/.hgignore index c0e25ff8a9..2b7aa3f2d7 100644 --- a/.hgignore +++ b/.hgignore @@ -9,6 +9,8 @@ _ReSharper.* *.user *.suo +lib/NUnit 2.2.8.0/nunit-console.exe.config + syntax: regexp build/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,5}/ diff --git a/build/Build.bat b/build/Build.bat deleted file mode 100644 index 2b246cadf8..0000000000 --- a/build/Build.bat +++ /dev/null @@ -1,10 +0,0 @@ -@echo off -SET BUILD_TARGET=%1 -SET BUILD_CONFIG=%2 - -IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild -IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug - -CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=4.0 /toolsversion:4.0" - -pause \ No newline at end of file diff --git a/build/Build20.bat b/build/Build20.bat new file mode 100644 index 0000000000..25ac20a539 --- /dev/null +++ b/build/Build20.bat @@ -0,0 +1,8 @@ +@echo off +SET BUILD_TARGET=%~1 +SET BUILD_CONFIG=%~2 + +IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild +IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug + +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj /toolsversion:4.0 %3 %4 %5 %6 "/t:%BUILD_TARGET%" "/p:BuildConfiguration=%BUILD_CONFIG%;TargetVersion=2" diff --git a/build/BuildAll.bat b/build/BuildAll.bat index e80ac8d909..9f2ef1aac9 100644 --- a/build/BuildAll.bat +++ b/build/BuildAll.bat @@ -1,42 +1,2 @@ -@ECHO OFF - -SET PREV_WORKING_DIR=%CD% -CD %~dp0 - -REM -- 3.5 Debug build, ensure this continues to work -%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5" -IF ERRORLEVEL 1 GOTO ERROR - -REM -- 4.0 Debug build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -REM -- 4.0 Release build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -IF EXIST "%ProgramFiles%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT -IF EXIST "%ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT - -ECHO Unable to locate %ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0 -GOTO ERROR - -:SILVERLIGHT - -REM -- 4.0 Debug_Silverlight2 build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -REM -- 4.0 Release_Silverlight2 build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -GOTO END - -:ERROR -CD %PREV_WORKING_DIR% -PAUSE - -:END -CD %PREV_WORKING_DIR% -SET PREV_WORKING_DIR= \ No newline at end of file +@echo off +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj /t:FullBuild /toolsversion:4.0 %1 %2 %3 %4 %5 %6 diff --git a/build/BuildSilverlight2.bat b/build/BuildSilverlight2.bat index 1baccacfdf..6fddcb08ca 100644 --- a/build/BuildSilverlight2.bat +++ b/build/BuildSilverlight2.bat @@ -1,5 +1,2 @@ @echo off - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" - -pause \ No newline at end of file +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj /toolsversion:4.0 /t:RunBenchmarks %1 %2 %3 %4 "/p:BuildConfiguration=Debug;TargetVersion=2" diff --git a/build/Common.targets b/build/Common.targets index 140ea8f31e..4e42999942 100644 --- a/build/Common.targets +++ b/build/Common.targets @@ -2,10 +2,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13,73 +46,119 @@ - + - + + + + + + + + + - - + + + + + + + + + + - - - + + + + - + - + + + - + + + + - - - - + + + - + - - + + - - + + + + $(BenchmarkProtosDirectory)\google_size.proto $(BenchmarkProtosDirectory)\google_speed.proto - - + + + + + + + + - - + + - + - + @@ -93,7 +172,6 @@ - @@ -104,12 +182,10 @@ - - @(BenchmarkParameter) - $(BenchmarkParameterList.Replace(`;`,` `)) - - - + + + \ No newline at end of file diff --git a/build/GenerateCompletePackage.bat b/build/GenerateCompletePackage.bat deleted file mode 100644 index e281596116..0000000000 --- a/build/GenerateCompletePackage.bat +++ /dev/null @@ -1,19 +0,0 @@ -@ECHO OFF -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:PrepareOutputDirectory -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Debug /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=AllBinariesAndSource.zip /p:Platform="Any CPU" - -:END \ No newline at end of file diff --git a/build/GenerateReleasePackage.bat b/build/GenerateReleasePackage.bat deleted file mode 100644 index bd2a7f867f..0000000000 --- a/build/GenerateReleasePackage.bat +++ /dev/null @@ -1,13 +0,0 @@ -@ECHO OFF -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:PrepareOutputDirectory -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=ReleaseBinaries.zip /p:Platform="Any CPU" - -:END \ No newline at end of file diff --git a/build/Google.ProtocolBuffers.nuspec b/build/Google.ProtocolBuffers.nuspec index 64f17b4147..ec62523a32 100644 --- a/build/Google.ProtocolBuffers.nuspec +++ b/build/Google.ProtocolBuffers.nuspec @@ -43,16 +43,22 @@ Language Guide - http://code.google.com/apis/protocolbuffers/docs/proto.html - - + + + + + + - - + + + + + + - - - + diff --git a/build/Google.ProtocolBuffersLite.nuspec b/build/Google.ProtocolBuffersLite.nuspec index 75646ce8b5..819eab62f1 100644 --- a/build/Google.ProtocolBuffersLite.nuspec +++ b/build/Google.ProtocolBuffersLite.nuspec @@ -43,23 +43,29 @@ Language Guide - http://code.google.com/apis/protocolbuffers/docs/proto.html - - + + + + + + - - + + + + + + - - - + - + diff --git a/build/PublishRelease.bat b/build/PublishRelease.bat index 15f7bdcbc7..f02bdb1069 100644 --- a/build/PublishRelease.bat +++ b/build/PublishRelease.bat @@ -22,19 +22,24 @@ CMD.exe /Q /C "CD .. && lib\StampVersion.exe /major:2 /minor:4 /build:1 /revisio IF EXIST "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\sn.exe" SET WIN7SDK_DIR=C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\ IF NOT EXIST "..\release-key" hg clone https://bitbucket.org/rknapp/protobuf-csharp-port-keyfile ..\release-key -SET PROTOBUF_KEY_FILE="/p:AssemblyOriginatorKeyFile=%~dp0..\release-key\Google.ProtocolBuffers.snk" MD "%2" -CMD.exe /Q /C "GenerateCompletePackage.bat" -COPY /y ..\build_output\AllBinariesAndSource.zip %2\protobuf-csharp-port-%2-full-binaries.zip -CMD.exe /Q /C "GenerateReleasePackage.bat" -COPY /y ..\build_output\ReleaseBinaries.zip %2\protobuf-csharp-port-%2-release-binaries.zip +CMD.exe /Q /C "BuildAll.bat /verbosity:minimal "/p:AssemblyOriginatorKeyFile=%~dp0..\release-key\Google.ProtocolBuffers.snk" + +COPY /y ..\build_output\Release-v2.0.zip %2\protobuf-csharp-port-%2-net20-release-binaries.zip +COPY /y ..\build_output\Release-v3.5.zip %2\protobuf-csharp-port-%2-net35-release-binaries.zip +COPY /y ..\build_output\Release-v4.0.zip %2\protobuf-csharp-port-%2-net40-release-binaries.zip + +COPY /y ..\build_output\Full-v2.0.zip %2\protobuf-csharp-port-%2-net20-full-binaries.zip +COPY /y ..\build_output\Full-v3.5.zip %2\protobuf-csharp-port-%2-net35-full-binaries.zip +COPY /y ..\build_output\Full-v4.0.zip %2\protobuf-csharp-port-%2-net40-full-binaries.zip + ..\lib\NuGet.exe pack Google.ProtocolBuffers.nuspec -Symbols -Version %2 -NoPackageAnalysis -OutputDirectory %2 ..\lib\NuGet.exe pack Google.ProtocolBuffersLite.nuspec -Symbols -Version %2 -NoPackageAnalysis -OutputDirectory %2 + hg archive %2\protobuf-csharp-port-%2-source.zip -SET PROTOBUF_KEY_FILE= -"%WIN7SDK_DIR%sn.exe" -T ..\build_output\Package\Release\Google.ProtocolBuffers.dll +"%WIN7SDK_DIR%sn.exe" -T ..\build_output\v2.0\Release\Google.ProtocolBuffers.dll @ECHO. @ECHO *********************************************************** @ECHO IMPORTANT: Verify the above key output is: 55f7125234beb589 @@ -61,8 +66,12 @@ hg push SET GOOGLEUPLOAD=python.exe googlecode_upload.py --project protobuf-csharp-port --user "%3" --password "%4" %GOOGLEUPLOAD% --labels Type-Source,Featured --summary "Version %2 source" %2\protobuf-csharp-port-%2-source.zip -%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries (all configurations)" %2\protobuf-csharp-port-%2-full-binaries.zip -%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries (release only)" %2\protobuf-csharp-port-%2-release-binaries.zip +%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries for .NET 2.0 (all configurations)" %2\protobuf-csharp-port-%2-net20-full-binaries.zip +%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries for .NET 3.5 (all configurations)" %2\protobuf-csharp-port-%2-net35-full-binaries.zip +%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries for .NET 4.0 (all configurations)" %2\protobuf-csharp-port-%2-net40-full-binaries.zip +%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries for .NET 2.0 (release only)" %2\protobuf-csharp-port-%2-net20-release-binaries.zip +%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries for .NET 3.5 (release only)" %2\protobuf-csharp-port-%2-net35-release-binaries.zip +%GOOGLEUPLOAD% --labels Type-Executable,Featured --summary "Version %2 binaries for .NET 4.0 (release only)" %2\protobuf-csharp-port-%2-net40-release-binaries.zip @SET GOOGLEUPLOAD= @ECHO. diff --git a/build/RunBenchmarks.bat b/build/RunBenchmarks.bat index 5a32f3f2b3..5cb3e6a535 100644 --- a/build/RunBenchmarks.bat +++ b/build/RunBenchmarks.bat @@ -1,5 +1,2 @@ @echo off - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild %~dp0\build.csproj /m /t:RunBenchmarks /p:BuildConfiguration=Release /p:Platform="Any CPU" - -pause \ No newline at end of file +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj /toolsversion:4.0 /t:RunBenchmarks %1 %2 %3 %4 "/p:BuildConfiguration=Release;TargetVersion=2" diff --git a/build/build.csproj b/build/build.csproj index d2d5d04cea..bbc4392a93 100644 --- a/build/build.csproj +++ b/build/build.csproj @@ -4,29 +4,45 @@ Protocol Buffers Error - 4.0 - TargetFrameworkVersion=v2.0; - + Any CPU + + 3.5 + 4.0 + + v2.0 + v3.5 + v4.0 + $(ForcedFrameworkVersion) + + v2.0 + v3.0 + v4.0 $(MSBuildProjectDirectory)\.. $(ProjectDirectory)\src $(ProjectDirectory)\lib $(ProjectDirectory)\protos + + $(ProjectDirectory)\build_temp\GeneratedSource + $(ProjectDirectory)\build_temp\$(BuildConfiguration)$(TargetVersion) + $(ProjectDirectory)\build_output + $(BuildOutputDirectory)\$(ForcedFrameworkVersion) + + /v2 /fast /formats + $(BuildTempDirectory)\..\BenchmarkResults.txt $(ProjectDirectory)\benchmarks - $(ProjectDirectory)\build_temp\$(BuildConfiguration) - $(ProjectDirectory)\build_output\$(BuildConfiguration) $(BuildConfiguration) - $(SourceDirectory)\ProtocolBuffers.sln - $(SourceDirectory)\ProtocolBuffers2008.sln + $(SourceDirectory)\ProtocolBuffers.sln $(LibDirectory)\protoc.exe - $(SourceDirectory)\ProtoGen\bin\$(BuildConfiguration)\protogen.exe + $(BuildOutputDirectory)\ProtoGen\protogen.exe $(BuildTempDirectory)\ProtoBench.exe $(LibDirectory)\NUnit 2.2.8.0\nunit-console.exe + $(LibDirectory)\NUnit 2.2.8.0\nunit-console.$(ForcedFrameworkVersion).config $(LibDirectory)\7-Zip 9.20\7za.exe @@ -34,7 +50,6 @@ - @@ -62,92 +77,92 @@ - + $(SourceDirectory)\ProtocolBuffers\DescriptorProtos - + $(SourceDirectory)\ProtocolBuffers\DescriptorProtos - + $(SourceDirectory)\AddressBook - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos - + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos @@ -167,8 +182,14 @@ - - \protos + + \protos\google\protobuf + + + \protos\google\protobuf + + + \protos\tutorial \Protoc @@ -178,14 +199,15 @@ - + - + - - + + + diff --git a/build/build35.bat b/build/build35.bat index 02f803bd93..34cb141b24 100644 --- a/build/build35.bat +++ b/build/build35.bat @@ -1,8 +1,8 @@ @echo off -SET BUILD_TARGET=%1 -SET BUILD_CONFIG=%2 +SET BUILD_TARGET=%~1 +SET BUILD_CONFIG=%~2 IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug -CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5" +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj /toolsversion:4.0 %3 %4 %5 %6 "/t:%BUILD_TARGET%" "/p:BuildConfiguration=%BUILD_CONFIG%;TargetVersion=3" diff --git a/build/build40.bat b/build/build40.bat new file mode 100644 index 0000000000..1a0518cec6 --- /dev/null +++ b/build/build40.bat @@ -0,0 +1,8 @@ +@echo off +SET BUILD_TARGET=%~1 +SET BUILD_CONFIG=%~2 + +IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild +IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug + +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj /toolsversion:4.0 %3 %4 %5 %6 "/t:%BUILD_TARGET%" "/p:BuildConfiguration=%BUILD_CONFIG%;TargetVersion=4" diff --git a/lib/NUnit 2.2.8.0/nunit-console.exe.config b/lib/NUnit 2.2.8.0/nunit-console.v2.0.config similarity index 97% rename from lib/NUnit 2.2.8.0/nunit-console.exe.config rename to lib/NUnit 2.2.8.0/nunit-console.v2.0.config index 10bc6654b2..f01f07d020 100644 --- a/lib/NUnit 2.2.8.0/nunit-console.exe.config +++ b/lib/NUnit 2.2.8.0/nunit-console.v2.0.config @@ -1,5 +1,10 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/NUnit 2.2.8.0/nunit-console.v4.0.config b/lib/NUnit 2.2.8.0/nunit-console.v4.0.config new file mode 100644 index 0000000000..999eed1c61 --- /dev/null +++ b/lib/NUnit 2.2.8.0/nunit-console.v4.0.config @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ProtoBench/Program.cs b/src/ProtoBench/Program.cs index 90d9438427..820fc1240e 100644 --- a/src/ProtoBench/Program.cs +++ b/src/ProtoBench/Program.cs @@ -62,6 +62,15 @@ namespace Google.ProtocolBuffers.ProtoBench private static BenchmarkTest RunBenchmark; + private static string _logFile; + static void WriteLine(string format, params object[] arg) + { + if (arg.Length > 0) format = String.Format(format, arg); + Console.Out.WriteLine(format); + if (!String.IsNullOrEmpty(_logFile)) + File.AppendAllText(_logFile, format + Environment.NewLine); + } + [STAThread] public static int Main(string[] args) { @@ -70,6 +79,18 @@ namespace Google.ProtocolBuffers.ProtoBench Verbose = temp.Remove("/verbose") || temp.Remove("-verbose"); OtherFormats = temp.Remove("/formats") || temp.Remove("-formats"); + foreach (string arg in temp) + { + if (arg.StartsWith("/log:", StringComparison.OrdinalIgnoreCase) || arg.StartsWith("-log:", StringComparison.OrdinalIgnoreCase)) + { + _logFile = arg.Substring(5); + if (!String.IsNullOrEmpty(_logFile)) + File.AppendAllText(_logFile, Environment.NewLine + "Started benchmarks at " + DateTime.Now + Environment.NewLine); + temp.Remove(arg); + break; + } + } + if (true == (FastTest = (temp.Remove("/fast") || temp.Remove("-fast")))) { TargetTime = TimeSpan.FromSeconds(10); @@ -120,7 +141,7 @@ namespace Google.ProtocolBuffers.ProtoBench /// public static bool RunTest(string typeName, string file, byte[] inputData) { - Console.WriteLine("Benchmarking {0} with file {1}", typeName, file); + WriteLine("Benchmarking {0} with file {1}", typeName, file); IMessage defaultMessage; try { @@ -238,7 +259,7 @@ namespace Google.ProtocolBuffers.ProtoBench new DictionaryReader(dictionary).Merge(defaultMessage.WeakCreateBuilderForType()). WeakBuild()); } - Console.WriteLine(); + WriteLine(String.Empty); return true; } catch (Exception e) @@ -281,7 +302,7 @@ namespace Google.ProtocolBuffers.ProtoBench double first = (iterations*dataSize)/(elapsed.TotalSeconds*1024*1024); if (Verbose) { - Console.WriteLine("Round ---: Count = {1,6}, Bps = {2,8:f3}", 0, iterations, first); + WriteLine("Round ---: Count = {1,6}, Bps = {2,8:f3}", 0, iterations, first); } elapsed = TimeSpan.Zero; int max = (int) TargetTime.TotalSeconds; @@ -294,7 +315,7 @@ namespace Google.ProtocolBuffers.ProtoBench double bps = (iterations*dataSize)/(cycle.TotalSeconds*1024*1024); if (Verbose) { - Console.WriteLine("Round {1,3}: Count = {2,6}, Bps = {3,8:f3}", + WriteLine("Round {1,3}: Count = {2,6}, Bps = {3,8:f3}", 0, runs, iterations, bps); } @@ -308,7 +329,7 @@ namespace Google.ProtocolBuffers.ProtoBench } Thread.EndThreadAffinity(); - Console.WriteLine( + WriteLine( "{1}: averages {2} per {3:f3}s for {4} runs; avg: {5:f3}mbps; best: {6:f3}mbps; worst: {7:f3}mbps", 0, name, totalCount/runs, elapsed.TotalSeconds/runs, runs, (totalCount*dataSize)/(elapsed.TotalSeconds*1024*1024), best, worst); @@ -331,7 +352,7 @@ namespace Google.ProtocolBuffers.ProtoBench // to avoid overflow issues. iterations = (int) ((TargetTime.Ticks/(double) elapsed.Ticks)*iterations); elapsed = TimeAction(action, iterations); - Console.WriteLine("{0}: {1} iterations in {2:f3}s; {3:f3}MB/s", + WriteLine("{0}: {1} iterations in {2:f3}s; {3:f3}MB/s", name, iterations, elapsed.TotalSeconds, (iterations*dataSize)/(elapsed.TotalSeconds*1024*1024)); } diff --git a/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj b/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj index 457b166722..ad6e8479f0 100644 --- a/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj +++ b/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj @@ -34,7 +34,8 @@ false false true - TRACE;NET20; + v2.0 + NET20; true @@ -43,7 +44,7 @@ bin\Debug\ $(OutputPath)\$(AssemblyName).xml 1591, 1570, 1571, 1572, 1573, 1574 - $(DefineConstants)DEBUG; + $(DefineConstants)TRACE;DEBUG; prompt 4 true @@ -55,32 +56,32 @@ bin\Release\ $(OutputPath)\$(AssemblyName).xml 1591, 1570, 1571, 1572, 1573, 1574 - $(DefineConstants) + $(DefineConstants)TRACE; prompt 4 true AllRules.ruleset - + true full false - bin\Debug_Silverlight2\ + bin\Debug_Silverlight\ $(OutputPath)\$(AssemblyName).xml 1591, 1570, 1571, 1572, 1573, 1574 - $(DefineConstants)DEBUG;SILVERLIGHT2 + $(DefineConstants)TRACE;DEBUG;SILVERLIGHT2 prompt 4 true AllRules.ruleset - + pdbonly true - bin\Release_Silverlight2\ + bin\Release_Silverlight\ $(OutputPath)\$(AssemblyName).xml 1591, 1570, 1571, 1572, 1573, 1574 - $(DefineConstants)SILVERLIGHT2 + $(DefineConstants)TRACE;SILVERLIGHT2 prompt 4 true @@ -139,8 +140,8 @@ - - + +