Skip to content

Commit 0850d9e

Browse files
Reousamarkmandel
andauthored
Added C# gRPC SDK (agones-dev#1315)
Added a C# wrapper for the Agones gRPC client built against .NET Standard 2.0 & Code Integrity tests built against .NET Core 2.2. Commit includes: - Core C# Wrapper - Fully async & automatic health checks. - Agones CI Gen, Build & Test scripts. - Docs. - Relevant .gitignore modifications. - Make targets for C# SDK - Configuration specific auto-generate (DebugProtoGen), for development purposes Resolves: agones-dev#884 , agones-dev#883 Co-authored-by: Mark Mandel <markmandel@google.com>
1 parent 154e7fe commit 0850d9e

13 files changed

Lines changed: 3183 additions & 1 deletion

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ build/local-includes/*
3232
!build/local-includes/README.md
3333
/release
3434
debug.test
35+
obj
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2020 Google LLC All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
ARG BASE_IMAGE=agones-build-sdk-base:latest
15+
FROM $BASE_IMAGE
16+
17+
# Add installation step required to generate your SDK.
18+
# This should contains tooling required to generate GRPC code, build (if distribution is required)
19+
# and test your integration.
20+
21+
RUN apt-get update \
22+
&& apt-get install -y wget
23+
24+
RUN apt-get update \
25+
&& apt-get install -y apt-transport-https
26+
27+
RUN wget -q https://packages.microsoft.com/config/ubuntu/19.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
28+
&& dpkg -i packages-microsoft-prod.deb \
29+
&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
30+
&& dpkg -i packages-microsoft-prod.deb
31+
32+
33+
RUN apt-get update \
34+
&& apt-get install -y dotnet-sdk-2.2
35+
36+
# code generation scripts
37+
COPY *.sh /root/
38+
RUN chmod +x /root/*.sh
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2020 Google LLC All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ex
18+
19+
#Is obsolete if artifacts are not needed when NuGet publish is written.
20+
#I'm still not sure how the artifacts are used, using `publish` for self-contained release packages.
21+
cd ./sdks/csharp/sdk
22+
dotnet publish -c Release
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2020 Google LLC All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ex
18+
19+
sdk=/go/src/agones.dev/agones/proto/sdk
20+
googleapis=/go/src/agones.dev/agones/proto/googleapis
21+
protoc_destination=/go/src/agones.dev/agones/sdks/csharp/sdk/generated
22+
23+
# Generate C# proto file `Sdk.cs`
24+
protoc --csharp_out=${protoc_destination} -I ${sdk} -I ${googleapis} --plugin=protoc-gen-grpc=`which grpc_csharp_plugin` sdk.proto
25+
# Generate proto stub?
26+
protoc --grpc_out=${protoc_destination} -I ${sdk} -I ${googleapis} --plugin=protoc-gen-grpc=`which grpc_csharp_plugin` sdk.proto
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2020 Google LLC All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ex
18+
19+
# build the SDK project
20+
# Run Code Integirty tests
21+
cd ./sdks/csharp/test
22+
23+
dotnet test -c Release

‎build/includes/sdk.mk‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ gen-sdk-grpc: COMMAND := gen
6161
gen-sdk-grpc: run-sdk-command
6262

6363
# Runs a command on all supported languages, use COMMAND variable to select which command.
64-
run-all-sdk-command: run-sdk-command-go run-sdk-command-rust run-sdk-command-cpp run-sdk-command-node run-sdk-command-restapi
64+
run-all-sdk-command: run-sdk-command-go run-sdk-command-rust run-sdk-command-cpp run-sdk-command-node run-sdk-command-restapi run-sdk-command-csharp
6565

6666
run-sdk-command-node:
6767
$(MAKE) run-sdk-command COMMAND=$(COMMAND) SDK_FOLDER=node
@@ -78,6 +78,8 @@ run-sdk-command-go:
7878
run-sdk-command-restapi:
7979
$(MAKE) run-sdk-command COMMAND=$(COMMAND) SDK_FOLDER=restapi
8080

81+
run-sdk-command-csharp:
82+
$(MAKE) run-sdk-command COMMAND=$(COMMAND) SDK_FOLDER=csharp
8183

8284
# Runs a command for a specific SDK if it exists.
8385
run-sdk-command:

0 commit comments

Comments
 (0)