|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -e -u -x -o pipefail |
| 3 | + |
| 4 | +cd "$(dirname "$0")/../" |
| 5 | + |
| 6 | +ci/bootstrap.sh |
| 7 | +.shared-ci/scripts/prepare-unity.sh |
| 8 | + |
| 9 | +source .shared-ci/scripts/pinned-tools.sh |
| 10 | +source .shared-ci/scripts/profiling.sh |
| 11 | + |
| 12 | +UNITY_PROJECT_DIR="$(pwd)/workers/unity" |
| 13 | + |
| 14 | +# The asset cache ip cannot be hardcoded and so is stored in an environment variable on the build agent. |
| 15 | +# This is bash shorthand syntax for if-else predicated on the existance of the environment variable |
| 16 | +# where the else branch assigns an empty string. |
| 17 | +# i.e. - |
| 18 | +# if [ -z ${UNITY_ASSET_CACHE_IP} ]; then |
| 19 | +# ASSET_CACHE_ARG="-CacheServerIPAddress ${UNITY_ASSET_CACHE_IP}" |
| 20 | +# else |
| 21 | +# ASSET_CACHE_ARG="" |
| 22 | +# fi |
| 23 | + |
| 24 | +ASSET_CACHE_ARG=${UNITY_ASSET_CACHE_IP:+-CacheServerIPAddress "${UNITY_ASSET_CACHE_IP}"} |
| 25 | + |
| 26 | +markStartOfBlock "$0" |
| 27 | + |
| 28 | +markStartOfBlock "Building UnityClient" |
| 29 | + |
| 30 | +pushd "${UNITY_PROJECT_DIR}" |
| 31 | + dotnet run -p ../../.shared-ci/tools/RunUnity/RunUnity.csproj -- \ |
| 32 | + -projectPath "${UNITY_PROJECT_DIR}" \ |
| 33 | + -batchmode \ |
| 34 | + -quit \ |
| 35 | + -logfile "$(pwd)/../../logs/UnityClientBuild.log" \ |
| 36 | + -executeMethod "Improbable.Gdk.BuildSystem.WorkerBuilder.Build" \ |
| 37 | + ${ASSET_CACHE_ARG} \ |
| 38 | + +buildWorkerTypes "UnityClient" \ |
| 39 | + +buildTarget "cloud" |
| 40 | +popd |
| 41 | + |
| 42 | +markEndOfBlock "Building UnityClient" |
| 43 | + |
| 44 | +markStartOfBlock "Building UnityGameLogic" |
| 45 | + |
| 46 | +pushd "${UNITY_PROJECT_DIR}" |
| 47 | + dotnet run -p ../../.shared-ci/tools/RunUnity/RunUnity.csproj -- \ |
| 48 | + -projectPath "${UNITY_PROJECT_DIR}" \ |
| 49 | + -batchmode \ |
| 50 | + -quit \ |
| 51 | + -logfile "$(pwd)/../../logs/UnityGameLogicBuild.log" \ |
| 52 | + -executeMethod "Improbable.Gdk.BuildSystem.WorkerBuilder.Build" \ |
| 53 | + ${ASSET_CACHE_ARG} \ |
| 54 | + +buildWorkerTypes "UnityGameLogic" \ |
| 55 | + +buildTarget "cloud" |
| 56 | +popd |
| 57 | + |
| 58 | +markEndOfBlock "Building UnityGameLogic" |
| 59 | + |
| 60 | +markEndOfBlock "$0" |
0 commit comments