-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Pack protos in NuGet package for Google.Api.CommonProtos
Additionally, add msbuild support so that the common protos will be used implicitly by Grpc.Tools if IncludeGoogleApiCommonProtos is set to true.
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Google.Api.CommonProtos/build/Google.Api.CommonProtos.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<!-- This targets file allows the common protos, which are bundled in the NuGet package, to be included in Grpc.Tools compilation. --> | ||
<!-- This saves the developer having to find and copy these files to the right location. --> | ||
<PropertyGroup> | ||
<!-- The path of the proto files. Content from the nupkg. --> | ||
<GoogleApiCommonProtos_ProtosPath>$( [System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../content/protos) )</GoogleApiCommonProtos_ProtosPath> | ||
</PropertyGroup> | ||
|
||
<!-- Run immediately before the Protobuf_BeforeCompile extension point. --> | ||
<!-- Only include protos if project has set <IncludeGoogleApiCommonProtos> property to true. --> | ||
<Target Name="GoogleApiCommonProtos_BeforeCompile" | ||
BeforeTargets="Protobuf_BeforeCompile" | ||
Condition=" '$(IncludeGoogleApiCommonProtos)' == 'true' "> | ||
<PropertyGroup> | ||
<!-- Add nupkg proto files by including path in Protobuf_StandardImportsPath. --> | ||
<Protobuf_StandardImportsPath>$(Protobuf_StandardImportsPath);$(GoogleApiCommonProtos_ProtosPath)</Protobuf_StandardImportsPath> | ||
</PropertyGroup> | ||
<Message Text="Included proto files at $(GoogleApiCommonProtos_ProtosPath) in import path." Importance="high" /> | ||
<Message Text="Updated proto imports path: $(Protobuf_StandardImportsPath)" Importance="high" /> | ||
</Target> | ||
</Project> |