#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$SCRIPT_DIR"
OUTPUT_DIR="$PROJECT_DIR/target/release"

echo "==> Building DPMasterTokenClient for macOS"
cd "$PROJECT_DIR"

if ! command -v cargo >/dev/null 2>&1; then
  echo "Rust toolchain was not found. Install Rust from https://rustup.rs and try again."
  exit 1
fi

cargo build --release

echo
echo "Build completed successfully."
echo "Executable:"
echo "  $OUTPUT_DIR/dp_master_token_client"
