From a050655e9557411bc57f6fdd113f8c91d3ef5b7f Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Thu, 5 Oct 2017 15:41:39 +0800 Subject: [PATCH 1/8] [C# grpc] Include grpc generated files automatically. --- cs/build/nuget/Common.targets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cs/build/nuget/Common.targets b/cs/build/nuget/Common.targets index 56e6f2265d..e5fe734f1e 100644 --- a/cs/build/nuget/Common.targets +++ b/cs/build/nuget/Common.targets @@ -127,6 +127,12 @@ %(BondCodegen.Identity) + <_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" + Condition="'%(BondCodegen.Options)' != ''"> + true + %(BondCodegen.Identity) + + <_BondGeneratedFileNames Include="@(_BondGeneratedFiles)"/> From 0bf999dd103b989dc8cf2190786cb68eb6eabe95 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Thu, 5 Oct 2017 15:51:39 +0800 Subject: [PATCH 2/8] [C# grpc] Include grpc generated files only for the one with options containing '--grpc'. --- cs/build/nuget/Common.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cs/build/nuget/Common.targets b/cs/build/nuget/Common.targets index e5fe734f1e..039283297a 100644 --- a/cs/build/nuget/Common.targets +++ b/cs/build/nuget/Common.targets @@ -128,7 +128,7 @@ <_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" - Condition="'%(BondCodegen.Options)' != ''"> + Condition="$([System.String]::Copy(%(BondCodegen.Options)).Contains('--grpc'))"> true %(BondCodegen.Identity) From 952b3f77206fda7a5ab39fcaa293938fac8753b8 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Thu, 5 Oct 2017 16:08:56 +0800 Subject: [PATCH 3/8] [C# grpc] Try fix build. --- cs/build/nuget/Common.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cs/build/nuget/Common.targets b/cs/build/nuget/Common.targets index 039283297a..2ad850fea3 100644 --- a/cs/build/nuget/Common.targets +++ b/cs/build/nuget/Common.targets @@ -128,7 +128,7 @@ <_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" - Condition="$([System.String]::Copy(%(BondCodegen.Options)).Contains('--grpc'))"> + Condition="$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc'))"> true %(BondCodegen.Identity) From 821245ebd62dd40827275314f7eec15a50ed3e3d Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Thu, 5 Oct 2017 16:30:42 +0800 Subject: [PATCH 4/8] [C# grpc] Exclude the manual imported generated *_grpc.cs files. --- cs/test/compat/grpc/shared/GrpcCompatShared.csproj | 2 +- examples/cs/grpc/pingpong/grpc_pingpong.csproj | 3 +-- examples/cs/grpc/scalar/grpc_scalar.csproj | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cs/test/compat/grpc/shared/GrpcCompatShared.csproj b/cs/test/compat/grpc/shared/GrpcCompatShared.csproj index cd0d249236..ae72a96194 100644 --- a/cs/test/compat/grpc/shared/GrpcCompatShared.csproj +++ b/cs/test/compat/grpc/shared/GrpcCompatShared.csproj @@ -20,13 +20,13 @@ - --grpc + diff --git a/examples/cs/grpc/pingpong/grpc_pingpong.csproj b/examples/cs/grpc/pingpong/grpc_pingpong.csproj index 67f618e1ba..55253b30b1 100644 --- a/examples/cs/grpc/pingpong/grpc_pingpong.csproj +++ b/examples/cs/grpc/pingpong/grpc_pingpong.csproj @@ -46,9 +46,8 @@ + - - diff --git a/examples/cs/grpc/scalar/grpc_scalar.csproj b/examples/cs/grpc/scalar/grpc_scalar.csproj index 150a594682..866ca3af2b 100644 --- a/examples/cs/grpc/scalar/grpc_scalar.csproj +++ b/examples/cs/grpc/scalar/grpc_scalar.csproj @@ -51,9 +51,8 @@ + - - From 034690bdd3e155c9e5a1436836950dd474b55ca2 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Thu, 5 Oct 2017 19:23:12 +0800 Subject: [PATCH 5/8] Travis use msbuild instead of xbuild because it's deprecated. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c59c7447d5..b1336cf2c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,8 +72,8 @@ 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 + - if [ "$FLAVOR" == "cs" ]; then msbuild /p:Configuration=Debug cs/cs.sln; fi + - if [ "$FLAVOR" == "cs" ]; then msbuild /p:Configuration=Fields cs/cs.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 From ddc717e42309cf8235da7e155a28fb1338b7bf24 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Thu, 5 Oct 2017 20:34:27 +0800 Subject: [PATCH 6/8] Exclude Compiler.vcxproj from cs/cs.sln for Travis CI. --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b1336cf2c9..2464321e4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 msbuild /p:Configuration=Debug cs/cs.sln; fi - - if [ "$FLAVOR" == "cs" ]; then msbuild /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 + - 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 From 1bb45d89d0980b0158946927433c170cb5c01eb6 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 6 Oct 2017 11:50:15 +0800 Subject: [PATCH 7/8] [C# grpc] Fix the situation BondOptions contains --grpc option. --- cs/build/nuget/Common.targets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cs/build/nuget/Common.targets b/cs/build/nuget/Common.targets index 2ad850fea3..2028e6790c 100644 --- a/cs/build/nuget/Common.targets +++ b/cs/build/nuget/Common.targets @@ -127,6 +127,12 @@ %(BondCodegen.Identity) + <_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" + Condition="$(BondOptions.Contains('--grpc'))"> + true + %(BondCodegen.Identity) + + <_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" Condition="$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc'))"> true From a34707b68df81c3e41998ee6c12d623248b8a4c2 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 6 Oct 2017 12:24:24 +0800 Subject: [PATCH 8/8] [C# grpc] Separate into 2 situations: BondOptions contains --grpc for no-overridden BondCodegen items, the BondCodegen.Options contains --grpc. --- cs/build/nuget/Common.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cs/build/nuget/Common.targets b/cs/build/nuget/Common.targets index 2028e6790c..ed482ef246 100644 --- a/cs/build/nuget/Common.targets +++ b/cs/build/nuget/Common.targets @@ -127,14 +127,14 @@ %(BondCodegen.Identity) - <_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" - Condition="$(BondOptions.Contains('--grpc'))"> + <_BondGeneratedFiles Include="@(_BondCodegenWithDefaultOptions -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" + Condition="$(BondOptions.Contains('--grpc')) AND !$(BondOptions.Contains('--grpc=false'))"> true %(BondCodegen.Identity) <_BondGeneratedFiles Include="@(BondCodegen -> '$(BondOutputDirectory)\%(FileName)_grpc.cs')" - Condition="$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc'))"> + Condition="$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc')) AND !$([System.String]::new('%(BondCodegen.Options)').Contains('--grpc=false'))"> true %(BondCodegen.Identity)