#!/usr/bin/env bash

set -euxo pipefail

. ./ci/unity_version.sh

WORKSPACE=`pwd`
UNITY_INSTALL_PATH="/Applications/Unity/Hub/Editor"
BUILD_DIR=$1
LOG_PATH=$2

echo "Building in $1"

echo "Cleaning up $1"
/bin/rm -rf $1
/bin/mkdir -p $1

${UNITY_INSTALL_PATH}/${UNITY_VERSION}/Unity.app/Contents/MacOS/Unity \
   -nographics \
   -batchmode \
   -quit \
   -buildWindows64Player $BUILD_DIR/eagle0.exe \
   -logFile $LOG_PATH \
   -projectPath "$WORKSPACE/src/main/csharp/net/eagle0/clients/unity/eagle0"
