Skip to content

Commit

Permalink
[c# grpc] Include grpc generated files automatically
Browse files Browse the repository at this point in the history
* Two cases need to be handeled: $BondOptions contains --grpc for
  no-overridden BondCodegen items, the %BondCodegen.Options contains
  --grpc. Also --grpc=false needs to be handled in both cases.
* Updated the examples ad tests to no longer include the
  generated *_grpc.cs files.

Fixes #448
Closes #630
  • Loading branch information
hcoona authored and chwarr committed Oct 24, 2017
1 parent 9e349ff commit 61d9644
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ different versioning scheme, following the Haskell community's

### C# ###

* **Breaking change** The code generation MSBuild targets no longer support
Mono's xbuild: only MSBuild is supported. Mono has
[deprecated xbuild in favor MSBuild](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#msbuild)
now that
[MSBuild is open source and cross-platform](https://github.com/Microsoft/msbuild).
These are the MSBuild targets that run `gbc` on `BondCodegen` items.
* **Breaking change** The code generation MSBuild targets now automatically
compile the generated `_grpc.cs` files if `--grpc` is passed to `gbc`.
Explicit `<Compile Include="$(IntermediateOutputPath)foo_grpc.cs" />`
lines in MSBuild projects will need to be removed to fix error MSB3105
about duplicate items. See commit TBD for an example of how to fix this.
[Issue #448](https://github.com/Microsoft/bond/issues/448)
* Added `Bond.Box.Create` helper method to create `Bond.Box<T>` instances.
* Reflection.IsBonded now recognizes custom IBonded implementations.
* Use Newtonsoft's JSON.NET BigInteger support -- when available -- to
Expand Down
12 changes: 12 additions & 0 deletions cs/build/nuget/Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@
<DependentUpon>%(BondCodegen.Identity)</DependentUpon>
</_BondGeneratedFiles>

<_BondGeneratedFiles Include="@(_BondCodegenWithDefaultOptions -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')"
Condition="$(BondOptions.Contains('--grpc')) AND !$(BondOptions.Contains('--grpc=false'))">
<AutoGen>true</AutoGen>
<DependentUpon>%(BondCodegen.Identity)</DependentUpon>
</_BondGeneratedFiles>

<_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')"
Condition="$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc')) AND !$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc=false'))">
<AutoGen>true</AutoGen>
<DependentUpon>%(BondCodegen.Identity)</DependentUpon>
</_BondGeneratedFiles>

<_BondGeneratedFileNames Include="@(_BondGeneratedFiles)"/>
<Compile Include="@(_BondGeneratedFileNames)" />

Expand Down
2 changes: 1 addition & 1 deletion cs/test/compat/grpc/shared/GrpcCompatShared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="$(IntermediateOutputPath)\pingpong_grpc.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<BondCodegen Include="..\..\..\..\..\test\compat\grpc\pingpong.bond">
<Options>--grpc</Options>
</BondCodegen>
<!-- Resharper Workaround -->
<Compile Include="$(IntermediateOutputPath)\pingpong_types.cs" Condition="False" />
<Compile Include="$(IntermediateOutputPath)\pingpong_grpc.cs" Condition="False" />
<!-- End Resharper Workaround -->
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions examples/cs/grpc/pingpong/grpc_pingpong.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
</BondCodegen>
<!-- Resharper Workaround -->
<Compile Include="$(IntermediateOutputPath)\pingpong_types.cs" Condition="False" />
<Compile Include="$(IntermediateOutputPath)\pingpong_grpc.cs" Condition="False" />
<!-- End Resharper Workaround -->
<!-- TODO: edit the .targets to automatically include the grpc files -->
<Compile Include="$(IntermediateOutputPath)\pingpong_grpc.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Attributes">
Expand Down
3 changes: 1 addition & 2 deletions examples/cs/grpc/scalar/grpc_scalar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@
</BondCodegen>
<!-- Resharper Workaround -->
<Compile Include="$(IntermediateOutputPath)\scalar_types.cs" Condition="False" />
<Compile Include="$(IntermediateOutputPath)\scalar_grpc.cs" Condition="False" />
<!-- End Resharper Workaround -->
<!-- TODO: edit the .targets to automatically include the grpc files -->
<Compile Include="$(IntermediateOutputPath)\scalar_grpc.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Attributes">
Expand Down

0 comments on commit 61d9644

Please sign in to comment.