#!/bin/bash
set -e

# Change to script directory
cd "$(dirname "$0")"

echo "Building herolib-os..."
RUSTFLAGS="-A warnings" cargo build --release --features repl

echo "Building documentation..."
RUSTFLAGS="-A warnings" cargo doc --no-deps

# Install binary
echo "Installing hero-os to ~/hero/bin/..."
mkdir -p ~/hero/bin
rm -f ~/hero/bin/hero-os
cp target/release/hero-os ~/hero/bin/

echo ""
echo "Build complete!"
echo "Binary installed: ~/hero/bin/hero-os"
