#!/usr/bin/env bash

set -e

if [[ $# -ne 1 ]]
then
  echo "Expected the tango installation folder as argument"
  exit 1
fi

tango_inst_folder=$1

top_level=$(git rev-parse --show-toplevel)

cd $top_level

# Gather all to-be-installed include files (ignoring windows specific ones)
git ls-files --full-name                    \
             'src/include/**/*.h'           \
             'src/include/**/*.h.in'        \
             ':^src/include/tango/internal' \
             ':^src/include/tango/windows'  \
| sed -e 's;src/include/;;' -e 's;\.in;;' | sort > files_repo.txt

# and all installed files, minus the generated idl file
find $tango_inst_folder -iname '*.h' | grep -v "tango/idl/tango.h" | sed -e "s;$tango_inst_folder/include/tango;tango;" | sort > files_installed.txt

git diff --no-index files_repo.txt files_installed.txt
