#!/bin/sh
set -C -e -f -u

TOP_SOURCE_DIR=`pwd`
cd "$ADTTMP"

cat > p.gpr <<EOF
with "xmlada";
project P is
   for Source_Dirs use ("$TOP_SOURCE_DIR/docs/dom");
   for Main use ("domexample.adb");
end P;
EOF

# gnatmake -q -P p.gpr, but ignoring a specific warning on stderr.
if ! gnatmake -q -P p.gpr 2> stderr
then
    cat stderr 1>&2
    false
fi
diff stderr - 1>&2 <<EOF
warning: gnatmake -P is obsolete and will not be available in the next release; use gprbuild instead
EOF

# domexample needs pref.xml in the current directory.
cd "$TOP_SOURCE_DIR/docs/dom"
"$ADTTMP/domexample"
