agones.dev/agones@v1.53.0/build/build-sdk-images/README.md (about) 1 # Agones SDKs build 2 3 As we seen before GameServers can communicate their current state back to Agones controller using a side car. This sidecar runs a GRPC server handling the communication to Agones, the GameServer connects using a SDK which a thin wrapper around GRPC client code. 4 5 By using GRPC, adding more languages should be pretty straightforward as it supports code generation for many of them. 6 7 > if your language doesn't support GRPC you can still create a SDK by connecting to the HTTP GRPC gateway. 8 9 This guide explains how to build, test and generate GRPC code for our SDKs but also how to add a new language. 10 11 ## How it works 12 13 Our build system heavily rely on Docker and make, but that's all you need. The rest of the GRPC tooling and language specific dependencies are installed inside Docker images via Dockerfile. 14 15 We separated each language specific tooling in their on Docker image, this way building them will be faster and easier to maintain. 16 17 A base GRPC image with protoc is provided, every other images inherit from it via the `FROM` Dockerfile syntax. This way SDKs grpc code is generated from the same version of our SDK sidecar. 18 19 ## Targets 20 21 We currently support 3 commands per SDK: 22 23 - `gen` to generate GRPC required by SDKs. 24 - `test` to run SDKs tests. 25 - `build` to build SDKs binaries. 26 27 > All commands might not be required for all SDKs. (e.g. build is only used for our cpp SDK) 28 29 SDKs build scripts and Dockerfile are stored in a folder in this directory. 30 31 To run tests for a single SDK use with the `SDK_FOLDER` of your choice: 32 33 ```bash 34 make test-sdk SDK_FOLDER=go 35 ``` 36 37 You can also run all SDKs tests by using `make test-sdks`. 38 39 To generate GRPC code and build binaries you can respectively use: 40 41 ```bash 42 make gen-sdk-grpc SDK_FOLDER=go 43 make build-sdk SDK_FOLDER=go 44 45 # for all SDKs 46 make gen-all-sdk-grpc 47 make build-sdks 48 ``` 49 50 ## Adding support for a new language 51 52 Makefile targets run docker containers built from Dockerfile in each folder found in this directory. This means you don't need to change our Makefile 53 54 Simply create a new directory with the name of your SDK. Then copy our [template](./tool/template) folder content you SDK folder. 55 56 Edit the Dockerfile to install all dependencies you need to generate, build and test your SDK. (you should not need to change the base image) 57 58 > As explained in our [SDK documentation](https://agones.dev/site/docs/guides/client-sdks/) you have 2 options HTTP or GRPC. If you are using HTTP you don't need to use our base SDK image so feel free to use the distribution of your choice. 59 60 Then add your steps in `build.sh`, `test.sh` and `gen.sh` script files. 61 62 You should now be able to use your `SDK_FOLDER` with our [Makefile targets](#targets). 63 64 Each targets will ensure that your Dockerfile is built and then run the image with a pre-defined command. The Agones code source repository is mounted in the working directory inside the container and you can also access the current Agones version via the environment variable `VERSION`.