Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C# grpc] Include grpc generated files automatically. #630

Closed
wants to merge 9 commits into from
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ script:
- if [ "$FLAVOR" == "cs" ]; then make DESTDIR=$HOME install; fi
- if [ "$FLAVOR" == "cs" ]; then cd ..; fi
- if [ "$FLAVOR" == "cs" ]; then export BOND_COMPILER_PATH=$HOME/usr/local/bin; fi
- if [ "$FLAVOR" == "cs" ]; then xbuild /p:Configuration=Debug cs/cs.sln; fi
- if [ "$FLAVOR" == "cs" ]; then xbuild /p:Configuration=Fields cs/cs.sln; fi
# exclude the Compiler.vcxproj from cs/cs.sln on Linux (xbuild ignore it with a warning but msbuild fail on it)
- if [ "$FLAVOR" == "cs" ]; then sed '/21E175D5-BBDD-4B63-8FB7-38899BF2F9D1/d' cs/cs.sln > cs/cs_no_cpp.sln; fi
- if [ "$FLAVOR" == "cs" ]; then msbuild /p:Configuration=Debug cs/cs_no_cpp.sln; fi
Copy link
Member

@chwarr chwarr Oct 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching to msbuild is understandable, but shouldn't be part of this PR. Can you revert the xbuild to msbuild changes from this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xbuild didn't get the property function work fine, so I have to switch to msbuild here. I'll make another PR for the msbuild switching.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chwarr Please see PR #633

- if [ "$FLAVOR" == "cs" ]; then msbuild /p:Configuration=Fields cs/cs_no_cpp.sln; fi
- if [ "$FLAVOR" == "cs" ]; then mono NUnit.Runners.2.6.4/tools/nunit-console.exe -framework=mono-4.5 -labels cs/test/core/bin/debug/net45/Properties/Bond.UnitTest.dll cs/test/core/bin/debug/net45/Fields/Bond.UnitTest.dll cs/test/internal/bin/debug/net45/Bond.InternalTest.dll; fi
- if [ "$FLAVOR" == "cpp-core" ]; then cmake -DBOND_SKIP_GBC_TESTS=TRUE -DBOND_ENABLE_GRPC=FALSE ..; fi
- if [ "$FLAVOR" == "cpp-core" ]; then make --jobs 2 check; fi
Expand Down
6 changes: 6 additions & 0 deletions cs/build/nuget/Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
<DependentUpon>%(BondCodegen.Identity)</DependentUpon>
</_BondGeneratedFiles>

<_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')"
Condition="$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc'))">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs to handle the case when the property $(BondOptions) contains "--grpc". Note that $(BondOptions) is only used for BondCodegen items that don't have overridden Options metadata. One of the examples can be changed to use $(BondOptions) as a test for this behavior.

<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