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.
 
 
 
 
 
 

195 lines
12 KiB

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- **********************************************************************************************
Targets For FullBuild
*********************************************************************************************** -->
<Target Name="_FullBuild" DependsOnTargets="_CleanOutputDirectory;_BuildProtoGen;_GenerateSource;_CopyGeneratedSource">
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;TargetVersion=2" Targets="_BuildAllConfigurations" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;TargetVersion=3" Targets="_BuildAllConfigurations" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;TargetVersion=4" Targets="_BuildAllConfigurations" />
</Target>
<Target Name="_BuildAllConfigurations">
<!-- Release Package -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;Platform=$(Platform);TargetVersion=$(TargetVersion);BuildConfiguration=Release" Targets="_BuildConfiguration" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;Platform=$(Platform);TargetVersion=$(TargetVersion);BuildConfiguration=Release_Silverlight" Targets="_BuildConfiguration" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;Platform=$(Platform);TargetVersion=$(TargetVersion);PackageName=Release-$(ForcedFrameworkVersion)" Targets="_GeneratePackage" />
<!-- Full Package -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;Platform=$(Platform);TargetVersion=$(TargetVersion);BuildConfiguration=Debug" Targets="_BuildConfiguration" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;Platform=$(Platform);TargetVersion=$(TargetVersion);BuildConfiguration=Debug_Silverlight" Targets="_BuildConfiguration" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;Platform=$(Platform);TargetVersion=$(TargetVersion);PackageName=Full-$(ForcedFrameworkVersion)" Targets="_GeneratePackage" />
</Target>
<Target Name="_BuildConfiguration" DependsOnTargets="_ReportConfig;_Clean;_BuildSolution;_Test;_PreparePackageComponent" />
<Target Name="_ReportConfig">
<Message Importance="high" Text="
Building $(BuildConfiguration) configuration for .NET Framework $(ForcedFrameworkVersion) $(Platform)" />
</Target>
<!-- **********************************************************************************************
Targets For Build
*********************************************************************************************** -->
<Target Name="_BuildSolution">
<Message Text="Running $(SolutionTarget) $(BuildConfiguration) with $(BuildTools) on $(SolutionFile)" Importance="normal" />
<MSBuild Targets="$(SolutionTarget)" Projects="$(SolutionFile)" ToolsVersion="$(BuildTools)"
Properties="Configuration=$(BuildConfiguration);Platform=$(Platform);TargetFrameworkVersion=$(ForcedFrameworkVersion);TreatWarningsAsErrors=true;SilverlightVersion=$(SilverlightVersion)"
/>
</Target>
<Target Name="_Clean">
<RemoveDir Directories="@(WorkingDirectories)" Condition="Exists(%(WorkingDirectories.Identity))" />
<MakeDir Directories="@(WorkingDirectories)" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Clean;BuildConfiguration=$(BuildConfiguration);Platform=$(Platform)" Targets="_BuildSolution" ContinueOnError="true" />
</Target>
<Target Name="_Compile">
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;BuildConfiguration=$(BuildConfiguration);Platform=$(Platform)" Targets="_BuildSolution" />
</Target>
<Target Name="Requires20">
<Error Text="Must be run with TargetVersion=2" Condition=" '$(TargetVersion)' != '2' " />
</Target>
<Target Name="RequiresRelease">
<Error Text="Must be run with BuildConfiguration=Release" Condition=" '$(BuildConfiguration)' != 'Release' " />
</Target>
<!-- **********************************************************************************************
Targets For GenerateSource
*********************************************************************************************** -->
<Target Name="_BuildProtoGen">
<MSBuild Targets="Rebuild" ToolsVersion="3.5"
Projects="$(ProjectDirectory)\src\ProtocolBuffers\ProtocolBuffers.csproj;$(ProjectDirectory)\src\ProtoGen\ProtoGen.csproj"
Properties="Step=_BuildProtoGen;Configuration=Release;Platform=AnyCPU;TargetFrameworkVersion=v2.0;DebugType=none;DocumentationFile=;TreatWarningsAsErrors=true;OutputPath=$(BuildOutputDirectory)\ProtoGen;" />
</Target>
<Target Name="_CleanTempSource">
<Message Importance="normal" Text="Cleaning source directory $(SourceTempDirectory)"/>
<RemoveDir Directories="$(SourceTempDirectory)" Condition="Exists($(SourceTempDirectory))" />
<MakeDir Directories="$(SourceTempDirectory)" />
</Target>
<Target Name="_GenerateSource" DependsOnTargets="_CleanTempSource">
<Message Importance="high" Text="Generating source from proto files" />
<Exec Command="$(ProtocExePath) --proto_path=$(ProtosDirectory) --descriptor_set_out=compiled.pb @(Protos->'%(RelativeDir)%(Filename)%(Extension)', ' ')" WorkingDirectory="$(SourceTempDirectory)" />
<Exec Command="$(ProtogenExePath) compiled.pb" WorkingDirectory="$(SourceTempDirectory)" />
<!-- Generate the AddressBookProtos.cs directly -->
<Exec Command="$(ProtogenExePath) --protoc_dir=$(LibDirectory) --proto_path=$(ProtosDirectory) $(ProtosDirectory)\tutorial\addressbook.proto -namespace=Google.ProtocolBuffers.Examples.AddressBook -umbrella_classname=AddressBookProtos" WorkingDirectory="$(SourceTempDirectory)" />
</Target>
<Target Name="_CopyGeneratedSource" DependsOnTargets="_GenerateSource">
<Copy SourceFiles="%(GeneratedSource.Identity)" DestinationFiles="%(GeneratedSource.TargetDirectory)\%(GeneratedSource.Filename)%(GeneratedSource.Extension)" />
</Target>
<!-- **********************************************************************************************
Targets For Test
*********************************************************************************************** -->
<Target Name="_Test">
<CallTarget Targets="_RunTests" />
</Target>
<Target Name="_RunTests">
<!-- NUnit -->
<Copy SourceFiles="$(NUnitExeConfig)" DestinationFiles="$(NUnitExePath).config" />
<Exec Condition="$(BuildConfiguration)=='Debug' or $(BuildConfiguration)=='Release'"
Command="&quot;$(NUnitExePath)&quot; /nologo /noshadow %(TestContainer.Identity) /xml:$(BuildTempDirectory)\%(TestContainer.Filename).xml" />
<!-- StatLight -->
<Exec Condition="$(BuildConfiguration)=='Debug_Silverlight' or $(BuildConfiguration)=='Release_Silverlight'"
Command="&quot;$(StatLightExePath)&quot; -x %(StatLightTestContainer.Identity) --ReportOutputFileType=NUnit --ReportOutputFile=$(BuildTempDirectory)\%(StatLightTestContainer.Filename).xml" />
</Target>
<!-- **********************************************************************************************
Targets For Package
*********************************************************************************************** -->
<Target Name="_CleanOutputDirectory">
<RemoveDir Directories="$(BuildOutputPackage)" ContinueOnError="true" />
<RemoveDir Directories="$(BuildOutputDirectory)" ContinueOnError="true" />
<MakeDir Directories="$(BuildOutputDirectory)" ContinueOnError="true" />
</Target>
<Target Name="_PreparePackageComponent">
<Copy SourceFiles="@(DynamicPackageItem)" DestinationFolder="$(BuildOutputPackage)\$(BuildConfiguration)\%(DynamicPackageItem.TargetDirectory)\%(DynamicPackageItem.RecursiveDir)" />
</Target>
<Target Name="_GeneratePackage">
<Copy SourceFiles="@(StaticPackageItem)" DestinationFolder="$(BuildOutputPackage)\%(StaticPackageItem.TargetDirectory)\%(StaticPackageItem.RecursiveDir)" />
<Exec Command="&quot;$(ZipExePath)&quot; a -tzip ..\$(PackageName).zip * -r" WorkingDirectory="$(BuildOutputPackage)" />
</Target>
<!-- **********************************************************************************************
Targets For Benchmark
*********************************************************************************************** -->
<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="$(SourceTempDirectory)" />
<Exec Command="$(ProtogenExePath) compiled.pb" WorkingDirectory="$(SourceTempDirectory)" />
</Target>
<Target Name="_CompileBenchmarkAssemblyInFramework20" Condition=" '$(MSBuildToolsVersion)' != '2.0' ">
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;BuildConfiguration=$(BuildConfiguration);Platform=$(Platform)"
Targets="_CompileBenchmarkAssembly" ToolsVersion="2.0" />
</Target>
<Target Name="_CompileBenchmarkAssembly" DependsOnTargets="_GenerateBenchmarkSource">
<Error Text="Must be run with Framework 2.0" Condition=" '$(MSBuildToolsVersion)' != '2.0' " />
<ItemGroup>
<BenchmarkSources Include="$(SourceTempDirectory)\GoogleSizeProtoFile.cs" />
<BenchmarkSources Include="$(SourceTempDirectory)\GoogleSpeedProtoFile.cs" />
<BenchmarkSources Include="$(SourceDirectory)\ProtoBench\Properties\AssemblyInfo.cs" />
</ItemGroup>
<Csc
TargetType="library"
OutputAssembly="$(BuildTempDirectory)\BenchmarkTypes.dll"
Optimize="true"
Sources="@(BenchmarkSources)"
References="$(SourceDirectory)\ProtocolBuffers\bin\$(BuildConfiguration)\Google.ProtocolBuffers.dll"
/>
</Target>
<Target Name="_PrepareBenchmarkEnvironment" DependsOnTargets="_CompileBenchmarkAssemblyInFramework20">
<ItemGroup>
<BenchmarkResources Include="$(BenchmarkProtosDirectory)\google_message1.dat" />
<BenchmarkResources Include="$(BenchmarkProtosDirectory)\google_message2.dat" />
<BenchmarkResources Include="$(SourceDirectory)\ProtocolBuffers\bin\$(BuildConfiguration)\Google.ProtocolBuffers.dll" />
<BenchmarkResources Include="$(SourceDirectory)\ProtocolBuffers.Serialization\bin\$(BuildConfiguration)\Google.ProtocolBuffers.Serialization.dll" />
<BenchmarkResources Include="$(SourceDirectory)\ProtoBench\bin\$(BuildConfiguration)\ProtoBench.exe" />
</ItemGroup>
<Copy SourceFiles="@(BenchmarkResources)" DestinationFolder="$(BuildTempDirectory)" />
</Target>
<Target Name="_RunBenchmarks" DependsOnTargets="_PrepareBenchmarkEnvironment">
<ItemGroup>
<BenchmarkParameter Include="Google.ProtocolBuffers.ProtoBench.SizeMessage1,BenchmarkTypes" />
<BenchmarkParameter Include="google_message1.dat" />
<BenchmarkParameter Include="Google.ProtocolBuffers.ProtoBench.SpeedMessage1,BenchmarkTypes" />
<BenchmarkParameter Include="google_message1.dat" />
<BenchmarkParameter Include="Google.ProtocolBuffers.ProtoBench.SizeMessage2,BenchmarkTypes" />
<BenchmarkParameter Include="google_message2.dat" />
<BenchmarkParameter Include="Google.ProtocolBuffers.ProtoBench.SpeedMessage2,BenchmarkTypes" />
<BenchmarkParameter Include="google_message2.dat" />
</ItemGroup>
<Message Text="Running $(ProtoBenchExePath) from $(BuildTempDirectory)" />
<Exec Command="&quot;$(ProtoBenchExePath)&quot; $(BenchmarkArgs) @(BenchmarkParameter->'%(Identity)', ' ') &quot;/log:$(BenchmarkOutputFile)&quot;"
WorkingDirectory="$(BuildTempDirectory)" />
</Target>
</Project>