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

# Jump into the driving directory where this file exists
builtin cd "$(dirname "$(readlink --canonicalize "${BASH_SOURCE[0]}")")"

# Change directory to the workspace root so we can use canonical relative paths
workspace_root="$(bazel info workspace)"
builtin cd "$workspace_root"

# Generate the ziod router config xml files
bazel_run //teleop/ziod/router/generate:generate_config -- \
  --router_output_dir "$workspace_root/teleop/ziod/router/config" \
  --recorder_output_dir "$workspace_root/teleop/ziod/logger/chum/config" \
  --bridge_output_dir "$workspace_root/teleop/telemetry/ros_dds_bridge/config" \
  --telemetry_state_output_dir "$workspace_root/teleop/launch/telemetry_states" \
  --telemetry_buckets_output_dir "$workspace_root/teleop/launch/telemetry_buckets" \
  --link_remote_config_output_dir "$workspace_root/vehicle/link/config"
