#!/bin/bash

if [ -z "${MESON_SOURCE_ROOT}" ]; then
  echo "[ERROR] This script can only be ran with meson!"
  exit 1
fi

set -e

cd "${MESON_SOURCE_ROOT}"

# MacOS does not necessarily have coreutils installed, but Python should be as btllib requires it
function portable_realpath() {
  python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' $1
}

files=$(find tests -type f | grep "\(.*\.h$\)\|\(.*\.hpp$\)\|\(.*\.cpp$\)\|\(.*\.cxx$\)")
for file in $files; do
  echo -n "$(portable_realpath $file) "
done