Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
4.4 KiB

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="_Clean">
<RemoveDir Directories="@(WorkingDirectories)" Condition="Exists(%(WorkingDirectories.Identity))" />
<MakeDir Directories="@(WorkingDirectories)" />
</Target>
<Target Name="_Compile">
<MSBuild Projects="%(Solution.Identity)" Properties="Configuration=%(Solution.Configuration);Platform=%(Solution.Platform)"
Targets="%(Solution.BuildTarget)" BuildInParallel="true" Condition="%(Solution.CompileGroup) == $(CompileGroup)" ToolsVersion="4.0" />
</Target>
<Target Name="_EnsureEnvironment">
<Error Text="Tool &quot;Protoc&quot; could not be found at path $(ProtocExePath)" Condition="!Exists($(ProtocExePath))" />
<Error Text="Tool &quot;Protogen&quot; could not be found at path $(ProtogenExePath)" Condition="!Exists($(ProtogenExePath))" />
</Target>
<Target Name="_GenerateSource" DependsOnTargets="_Clean;_Compile;_Compile">
<PropertyGroup>
<ProtosList>@(Protos)</ProtosList>
<Args>$(ProtosList.Replace(`;`,` `))</Args>
</PropertyGroup>
<Exec Command="$(ProtocExePath) --proto_path=$(ProtosDirectory) --descriptor_set_out=compiled.pb $(Args)" WorkingDirectory="$(BuildTempDirectory)" />
<Exec Command="$(ProtogenExePath) compiled.pb" WorkingDirectory="$(BuildTempDirectory)" />
</Target>
<Target Name="_CopyGeneratedSource" DependsOnTargets="_GenerateSource">
<Copy SourceFiles="%(GeneratedSource.Identity)" DestinationFiles="%(GeneratedSource.TargetDirectory)\%(GeneratedSource.Filename)%(GeneratedSource.Extension)" />
</Target>
<Target Name="_CompileGeneratedSource" DependsOnTargets="_CopyGeneratedSource">
<MSBuild Projects="%(Solution.Identity)" Properties="Configuration=%(Solution.Configuration);Platform=%(Solution.Platform)"
Targets="%(Solution.BuildTarget)" BuildInParallel="true" Condition="%(Solution.CompileGroup) == $(CompileGroup)" />
</Target>
<Target Name="_Test" DependsOnTargets="_CompileGeneratedSource">
<Exec Command="&quot;$(NUnitExePath)&quot; %(NUnitTests.Identity) /xml=%(NUnitTests.Filename)%(NUnitTests.Extension).xml" WorkingDirectory="$(BuildTempDirectory)" />
</Target>
<Target Name="_Package" DependsOnTargets="_CopyGeneratedSource">
<Copy SourceFiles="@(PackageContents)" DestinationFolder="$(PackageOutputDirectory)\%(PackageContents.TargetDirectory)\%(PackageContents.RecursiveDir)" />
</Target>
<!--
BENCHMARK - this needs optimising
-->
<Target Name="_GenerateBenchmarkSource">
<PropertyGroup>
<Args>$(BenchmarkProtosDirectory)\google_size.proto $(BenchmarkProtosDirectory)\google_speed.proto</Args>
</PropertyGroup>
<Exec Command="$(ProtocExePath) --proto_path=$(BenchmarkProtosDirectory);$(ProtosDirectory) --include_imports=compiled.pb --descriptor_set_out=compiled.pb $(Args)" WorkingDirectory="$(BenchmarkTempDirectory)" />
<Exec Command="$(ProtogenExePath) compiled.pb" WorkingDirectory="$(BenchmarkTempDirectory)" />
</Target>
<Target Name="_CompileBenchmarkAssembly">
<ItemGroup>
<BenchmarkSources Include="$(BenchmarkTempDirectory)\GoogleSizeProtoFile.cs" />
<BenchmarkSources Include="$(BenchmarkTempDirectory)\GoogleSpeedProtoFile.cs" />
</ItemGroup>
<Csc TargetType="library" OutputAssembly="$(BenchmarkTempDirectory)\BenchmarkTypes.dll" Optimize="true" Sources="@(BenchmarkSources)"
References="$(SourceDirectory)\ProtocolBuffers\bin\$(BuildConfiguration)\Google.ProtocolBuffers.dll" />
</Target>
<Target Name="_PrepareBenchmarkEnvironment">
<ItemGroup>
<BenchmarkResources Include="$(BenchmarkProtosDirectory)\google_message1.dat" />
<BenchmarkResources Include="$(BenchmarkProtosDirectory)\google_message2.dat" />
<BenchmarkResources Include="$(SourceDirectory)\ProtoBench\bin\$(BuildConfiguration)\ProtoBench.exe" />
</ItemGroup>
<Copy SourceFiles="@(BenchmarkResources)" DestinationFolder="$(BenchmarkTempDirectory)" />
</Target>
<Target Name="_RunBenchmark">
<PropertyGroup>
<Args>Google.ProtocolBuffers.ProtoBench.SizeMessage1,BenchmarkTypes google_message1.dat Google.ProtocolBuffers.ProtoBench.SpeedMessage1,BenchmarkTypes google_message1.dat Google.ProtocolBuffers.ProtoBench.SizeMessage2,BenchmarkTypes google_message2.dat Google.ProtocolBuffers.ProtoBench.SpeedMessage2,BenchmarkTypes google_message2.dat</Args>
</PropertyGroup>
<Exec Command="ProtoBench.exe $(Args)" WorkingDirectory="$(BenchmarkTempDirectory)" />
</Target>
</Project>