agones.dev/agones@v1.54.0/build/build-sdk-images/csharp/gen.sh (about) 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 proto=/go/src/agones.dev/agones/proto 20 sdk=${proto}/sdk 21 googleapis=${proto}/googleapis 22 csharp_proto_file_output_dir=/go/src/agones.dev/agones/sdks/csharp/proto 23 24 echo "Copying protobuffers to csharp sdk" 25 mkdir -p ${csharp_proto_file_output_dir} 26 cp -r ${sdk} ${csharp_proto_file_output_dir} 27 cp -r ${googleapis} ${csharp_proto_file_output_dir} 28 29 # Remove protoc-gen-openapiv2 definitions because C# package doesn't support grpc-gateway 30 sed -i -e 's/import "protoc-gen-openapiv2\/options\/annotations.proto";//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 31 sed -i -e 's/option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 32 sed -i -e 's/info: {//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 33 sed -i -e 's/title: "sdk.proto";//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 34 sed -i -z 's/version: "version not set";\n };//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 35 sed -i -e 's/schemes: HTTP;//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 36 sed -i -e 's/consumes: "application\/json";//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 37 sed -i -z 's/produces: "application\/json";\n};//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 38 sed -i -e 's/bool disabled = 1.*/bool disabled = 1;/' ${csharp_proto_file_output_dir}/sdk/sdk.proto 39 sed -i -e 's/^ *$//' ${csharp_proto_file_output_dir}/sdk/sdk.proto 40 41 sed -i -e 's/import "protoc-gen-openapiv2\/options\/annotations.proto";//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 42 sed -i -e 's/option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 43 sed -i -e 's/info: {//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 44 sed -i -e 's/title: "alpha.proto";//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 45 sed -i -z 's/version: "version not set";\n };//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 46 sed -i -e 's/schemes: HTTP;//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 47 sed -i -e 's/consumes: "application\/json";//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 48 sed -i -z 's/produces: "application\/json";\n};//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 49 sed -i -e 's/bool bool = 1.*/bool bool = 1;/' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 50 sed -i -e 's/^ *$//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto 51 52 sed -i -e 's/import "protoc-gen-openapiv2\/options\/annotations.proto";//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 53 sed -i -e 's/option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 54 sed -i -e 's/info: {//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 55 sed -i -e 's/title: "beta.proto";//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 56 sed -i -z 's/version: "version not set";\n };//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 57 sed -i -e 's/schemes: HTTP;//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 58 sed -i -e 's/consumes: "application\/json";//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 59 sed -i -z 's/produces: "application\/json";\n};//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 60 sed -i -e 's/bool bool = 1.*/bool bool = 1;/' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 61 sed -i -e 's/^ *$//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto 62 63 echo "csharp code is generated at build time"