#!/bin/bash

set -euxo pipefail

# Use runner-specific build directory if EAGLE0_BUILD_DIR is set, otherwise default
BUILD_BASE="${EAGLE0_BUILD_DIR:-/tmp/eagle0}"

COMMIT=$(/usr/bin/git rev-parse --short HEAD)

/bin/echo "build protos"
./scripts/build_protos.sh

git log -3

/bin/echo "build Windows"
LOG_PATH="${BUILD_BASE}/editor_win.log"
BUILD_DIR=$1
BUILD_ADDRESSABLES=${2:-true}
ADDRESSABLES_BUILD_LAYOUT=${3:-$BUILD_ADDRESSABLES}

./ci/github_actions/build_windows.sh "$BUILD_DIR" "$LOG_PATH" "$BUILD_ADDRESSABLES" "$ADDRESSABLES_BUILD_LAYOUT"
