Unf, CSName is necessary because protoc converts .proto filenames to TitleCase when generating .cs files. The other generated files (client.pb.cs, server.pb.cs and immutable.pb.cs) don't have this problem because they are generated with our own custom plugin.py, which gives us control over the generated filename.
69 lines
2.8 KiB
XML
69 lines
2.8 KiB
XML
<Project>
|
|
|
|
<!--
|
|
Run this after GetAssemblyVersion because it happens after the Xaml compiler
|
|
and exists in both xaml and non-xaml projects. One of the (many) xaml compile
|
|
passes wipes out the additional compile includes that we add.
|
|
-->
|
|
<Target
|
|
Name="CompileProto3"
|
|
AfterTargets="GetAssemblyVersion"
|
|
Condition="'@(Proto3)'!=''"
|
|
Inputs="$(protoc);
|
|
%(Proto3.Identity);$(ProtocPluginBase)/plugin.py;
|
|
$(ProtocPluginBase)/templates/c#/client.pb.cs;
|
|
$(ProtocPluginBase)/templates/c#/server.pb.cs;
|
|
$(ProtocPluginBase)/templates/c#/immutable.pb.cs;"
|
|
Outputs="
|
|
%(Proto3.OutDir)/%(Proto3.CSName).cs;
|
|
%(Proto3.OutDir)/%(Proto3.FileName).client.pb.cs;
|
|
%(Proto3.OutDir)/%(Proto3.FileName).server.pb.cs;
|
|
%(Proto3.OutDir)/%(Proto3.FileName).immutable.pb.cs">
|
|
<MakeDir Directories="%(Proto3.OutDir)" />
|
|
|
|
<Message
|
|
Importance="High"
|
|
Text="Generating service %(Proto3.FileName)" />
|
|
|
|
<PropertyGroup>
|
|
<GenProtosCmd>$(protoc) %(Proto3.FullPath)</GenProtosCmd>
|
|
<GenProtosCmd>$(GenProtosCmd) --error_format=msvs</GenProtosCmd>
|
|
<GenProtosCmd>$(GenProtosCmd) --proto_path=$(SourceRoot)</GenProtosCmd>
|
|
<GenProtosCmd>$(GenProtosCmd) --plugin="protoc-gen-service=$(ProtocPlugin)"</GenProtosCmd>
|
|
<GenProtosCmd>$(GenProtosCmd) --service_out=lang=c#,strip_out_path=1:%(Proto3.OutDir)</GenProtosCmd>
|
|
<GenProtosCmd>$(GenProtosCmd) --csharp_out=%(Proto3.OutDir)</GenProtosCmd>
|
|
</PropertyGroup>
|
|
<Exec Command="$(GenProtosCmd)" WorkingDirectory="%(Proto3.RelativeDir)" />
|
|
<ItemGroup>
|
|
<Compile Include="%(Proto3.OutDir)/%(Proto3.CSName).cs" />
|
|
<Compile Include="%(Proto3.OutDir)/%(Proto3.FileName).client.pb.cs" />
|
|
<Compile Include="%(Proto3.OutDir)/%(Proto3.FileName).server.pb.cs" />
|
|
<Compile Include="%(Proto3.OutDir)/%(Proto3.FileName).immutable.pb.cs" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target Name="RemoveSystemRuntimeFromRefPack"
|
|
BeforeTargets="_HandlePackageFileConflicts"
|
|
Condition="'@(Reference -> WithMetadataValue('NugetPackageId', 'System.Runtime.Experimental'))' != ''">
|
|
<ItemGroup>
|
|
<Reference Remove="@(Reference)"
|
|
Condition="$([System.String]::Copy(%(Reference.Identity)).Contains('System.Runtime.dll')) and
|
|
'%(Reference.NuGetPackageId)' == 'Microsoft.NETCore.App.Ref'" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target
|
|
Name="AfterClean"
|
|
AfterTargets="Clean">
|
|
<Delete Files="%(Proto3.OutDir)/%(Proto3.CSName).cs" />
|
|
<Delete Files="%(Proto3.OutDir)/%(Proto3.FileName).client.pb.cs" />
|
|
<Delete Files="%(Proto3.OutDir)/%(Proto3.FileName).server.pb.cs" />
|
|
<Delete Files="%(Proto3.OutDir)/%(Proto3.FileName).immutable.pb.cs" />
|
|
</Target>
|
|
|
|
<Target
|
|
Name="Test"
|
|
DependsOnTargets="Build"></Target>
|
|
|
|
</Project>
|